How to crawl Google results as a browser
I use the php curl extension function to crawl the page data of Google keywords, but added a header or something to crawl the returned page results are inconsistent with the browser.
So kneeling to ask which person can tell, how can I get my program to crawl the results of the page is consistent with the page results displayed by the browser.
Thank you
Only 20 points, I hope the Master can forgive.
------Solution--------------------
Like this, URL address you change it yourself.
PHP Code
Header ("content-type:text/html; Charset=utf-8 "); $ch = Curl_init (); $url = ' http://www.google.com/search?hl=zh-CN&biw=1366&bih=649&q= Ajax&oq=ajax+comment&aq=f&aqi=g9g-m1&aql=&gs_sm=e&gs_upl= 5916l9958l0l10319l16l14l1l0l0l0l267l1925l0.6.4l10l0 '; curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, CURLOPT _returntransfer, 1); curl_setopt ($ch, Curlopt_useragent, ' mozilla/5.0 (Windows; U Windows NT 6.1; En-us; rv:1.9.1.2) gecko/20090729 firefox/3.5.2 GTB5 '); $htmls = Curl_exec ($ch); Curl_close ($ch); Echo $htmls;