grimm

1.使用Snoopy或curl传搜索引擎爬虫的USERAGENT值。  

  查看搜索引擎爬虫的USERAGENT值:http://www.cnblogs.com/grimm/p/5068092.html (http://www.geekso.com/spdier-useragent/  )

2.使用Snoopy或curl传referer值。  

   如:$snoopy->referer = \'http://www.google.com\';        

     $header[] = "Referer: http://www.google.com/";

 3.使用Snoopy或curl代理。    

  如:$snoopy->proxy_host  = "59.108.44.41";          $

    snoopy->proxy_port  = "3128";  

4.使用Snoopy或curl防造IP。  

   如:$snoopy->rawheaders[\'X_FORWARDED_FOR\'] = \'127.0.0.1\';        

     $snoopy->rawheaders[\'CLIENT-IP\'] = \'127.0.0.1\';  

5.用php写一个重起路由器的程序,这样就会获得新的ip地址。

 6.如果发现重起路由器还是显示被封,有可能对方封了你路由器的mac地址,现在路由器都有修改MAC的功能,可以写程序或手动修改路由器的MAC地址。

例如:

  php curl伪装抓取

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0 ); // 过滤HTTP头
curl_setopt($ch, CURLOPT_TIMEOUT, 40);                                                                                                                   
curl_setopt($ch, CURLOPT_USERAGENT, \'Baiduspider+(+http://www.baidu.com/search/spider.htm)\');  
                                                       
$ip = \'220.181.7.121\';
curl_setopt($ch, CURLOPT_HTTPHEADER, array(\'X-FORWARDED-FOR:\' . $ip, \'CLIENT-IP:\' . $ip));                                                               
curl_setopt($ch, CURLOPT_REFERER, "http://www.baidu.com/search/spider.html");                                                                            
 
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);// 显示输出结果                                                                                               
$responseText = curl_exec($ch);                                                                                                                          
curl_close($ch)

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-18
  • 2022-01-04
  • 2021-07-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-29
  • 2022-03-08
  • 2021-06-25
  • 2021-11-12
  • 2021-09-16
  • 2021-08-01
  • 2021-06-09
相关资源
相似解决方案