idHTTP访问百度

百度屏蔽了indy的客户端标识的 Mozilla/3.0 (compatible; Indy Library),把‘Indy Library’去掉就可以了。 

  try
    IdHTTP1.Request.UserAgent := 'Mozilla/3.0 (compatible;)';
    aStr := IdHTTP1.Get('http://www.baidu.com');
  except

  end;

  

完整的:

‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)’

 

posted @ 2013-09-18 19:11  忘忧般若汤  阅读(408)  评论(0编辑  收藏  举报