Home > Backend Development > PHP Tutorial > php curl 获取信息不完整,该怎么解决

php curl 获取信息不完整,该怎么解决

WBOY
Release: 2016-06-13 12:11:04
Original
1738 people have browsed it

php curl 获取信息不完整

本帖最后由 hilives 于 2014-12-03 11:48:07 编辑 用 php curl 获取页面数据,页面有1000条数据,有时候可以获得1000条,有时候获得500条,600条,
有时候会不完整,求解,这是为啥
<br />$ch = curl_init();<br />     <br />       curl_setopt ($ch, CURLOPT_URL, $url);<br />    <br />       curl_setopt ($ch, CURLOPT_COOKIEJAR, "c:\cookie.txt");<br />       curl_setopt ($ch, CURLOPT_HEADER, 1);<br />       curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);<br />       curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);<br />	   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));<br />       curl_setopt ($ch, CURLOPT_TIMEOUT, 120);<br />       $result = curl_exec ($ch);<br />       curl_close($ch);<br />     echo $result;<br /><br /><br />
Copy after login

------解决思路----------------------
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);

這個設300看看。
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template