php curl 抓取数据伪装

<p>php curl伪装抓取</p><pre class="brush:php;toolbar:false">$ch=curl_init($url); curl_setopt($ch,CURLOPT_HEADER,0);//过滤HTTP头 curl_setopt($ch,CURLOPT_TIMEOUT,40); curl_setopt($ch,CURLOPT_USERAGENT,&#39;Baiduspider+(+http://www.baidu.com/search/spider.htm)&#39;); $ip=&#39;220.181.7.121&#39;; curl_setopt($ch,CURLOPT_HTTPHEADER,array(&#39;X-FORWARDED-FOR:&#39;.$ip,&#39;CLIENT-IP:&#39;.$ip)); curl_setopt($ch,CURLOPT_REFERER,&quot;http://www.baidu.com/search/spider.html&quot;); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//显示输出结果 $responseText=curl_exec($ch); curl_close($ch);</pre>

按月统计

  1. 2021-12 (357)
  2. 2022-02 (10)
  3. 2022-03 (10)
  4. 2022-05 (1)
  5. 2023-06 (108)
  6. 2023-07 (44)
  7. 2023-08 (3)
  8. 2023-09 (8)
RangeTime:0.021214s
RangeMem:208.27 KB
返回顶部 留言