json - PHP cURL multiple calls based on id's from database -
i'm trying automate 150 curls request based on different id's. every curl generates output in json. i've these id's in mysql database.
i think there following steps:
1.) id's database
2.) construct, load en save output every curl based on id. (www.domain.com//string)
3.) repeat step 2 each id.
i don't have experience in field question begin?
yes, that's right flow. let me give code think work. ok, first, assume have class db (i use meekrodb
);
$dataid = db::queryonecolumn('id', "select * your_table_data order some_column limit 150"); db::starttransaction(); foreach($dataid $id){ $response = requestwithcurl($id); db::insert('your_table', array('json_column' => $response)); } db::commit();
below function execute curl, please see php curl example
function requestwithcurl($id){ # initiate curl # define host/url # execute curl data contain $id # return curl response, assume response in json formatted }
hope works. :))
Comments
Post a Comment