我有一個網站,有一個簡單的API,可以通過HTTP使用。我希望一次使用API並提交大約1000-1500次的數據。這裏是他們的API:http://api.jum.name/這是使用PHP CURL進行API請求的最佳方式嗎?
我已經構建了URL進行提交,但現在我想知道什麼是使這些1000-1500 API GET請求的最佳方式?這裏是我正在考慮的PHP CURL實現:
$add = 'http://www.mysite.com/3rdparty/API/api.php?fn=post&username=test&password=tester&url=http://google.com&category=21&title=story a&content=content text&tags=Season,news';
curl_setopt ($ch, CURLOPT_URL, "$add");
curl_setopt ($ch, CURLOPT_POST, 0);
curl_setopt ($ch, CURLOPT_COOKIEFILE, 'files/cookie.txt');
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
$postdata = curl_exec ($ch);
每次我提交時應該關閉CURL連接嗎?我能否以更好的方式重新編寫上述內容,以便使這些1000-1500份提交更快?
感謝所有