计算成功的卷曲获取的最佳方法
我正在寻找计算成功的卷曲获取的最佳方法,我只是在这里将一些东西拼凑在一起,它可以工作,但有点慢,有没有更快的替代方案?我正在运行/刷新脚本超过一分钟,并尝试确定在那一分钟内成功拉取所有内容的次数。
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
$counter = @file_get_contents('count.txt');
$counter++;
@file_put_contents('count.txt', $counter);
}
I'm looking for the best way to count successful curl fetches, i sort of just pieced things together here, it works but its a bit slow, is there any faster alternative? I'm running/refreshing the script over one minute and trying to determine how many times everything is pulled successfully within that minute.
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
$counter = @file_get_contents('count.txt');
$counter++;
@file_put_contents('count.txt', $counter);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了加快速度,您可以使用多线程curl: http: //www.php.net/manual/en/function.curl-multi-info-read.php
To speed it up, you can use multithreaded curl: http://www.php.net/manual/en/function.curl-multi-info-read.php