How to crawl Google results like a browser

Source: Internet
Author: User
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;
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.