Home  >  Article  >  Backend Development  >  curl施行速度非常慢

curl施行速度非常慢

WBOY
WBOYOriginal
2016-06-13 13:13:292487browse

curl执行速度非常慢。
正常写了一个简单的curl抓取程序,但是执行之后不管是访问本地还是远程url速度都超过10秒响应。这是为什么啊
注:程序里有一个10*10的for循环,需要执行100次。

------解决方案--------------------
需要看到代码
------解决方案--------------------
对,可能就是那 10* 10 循环拖延了时间.
------解决方案--------------------
你在循环中执行 curl 100次,假定每次耗时 1 秒(不算多吧)那么就是 100 秒了

你可以 curl_multi 并发一下,那就快多了
------解决方案--------------------
sleep 只是减缓结果的产生,你已经都嫌慢了,还要有意使他更慢吗?

抓取的速度如何,取决于网络和对方响应的速度(curl_getinfo的结果中就有详细的报告)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn