我正在尝试根据不同的ID自动执行150 cURLS请求。每个cURL都以JSON格式生成输出。我在mysql数据库中有这些id。
我认为有以下步骤:
1。)从数据库获取id
2。)构造,根据id为每个cURL加载en save输出。 (www.domain.com//string)
3。)对每个id重复步骤2。
我在这个领域没有太多经验,所以我的问题是从哪里开始?
答案 0 :(得分:0)
meekrodb
);
$dataId = DB::queryOneColumn('id', "SELECT * FROM your_table_data ORDER by some_column LIMIT 150");
DB::startTransaction();
foreach($dataId as $id){
$response = requestWithCurl($id);
DB::insert('your_table', array('json_column' => $response));
}
DB::commit();
以下是执行cUrl的功能,请参阅php curl example
function requestWithCurl($id){
# initiate curl
# define host/url
# execute curl with data that contain $id
# return curl response, we assume that response already in json formatted
}
希望这有效。 :))