我有一个网站,它有一个可以通过 http 使用的简单 API。我希望利用 API 一次提交大约 1000-1500 次数据。这是他们的 API:http ://api.jum.name/
我已经构建了提交提交的 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 份提交更快吗?
谢谢大家