Redeem Spider-Captured PHP code

Source: Internet
Author: User
PHP code to implement spider capture

SEO (Search engine Optimization), the Chinese translation of Search engine optimization, for the more popular network marketing in recent years, the main purpose is to increase the exposure of specific keywords to increase the visibility of the site, thereby increasing sales opportunities. Divided into the station outside the SEO and site seo two kinds. The main work of SEO is to understand how various types of search engines crawl the Internet pages, how to index and how to determine their search results rankings for a particular keyword, to optimize the Web page, so that it can improve the search engine rankings, so as to improve the site visits, technologies that ultimately enhance the sales or promotional capabilities of the site.

?

Many do seo, often ask why my page is not included, why my snapshot or last week, how Baidu has not updated my site. These are the questions that have just started to ask. Do SEO people know, know the law of search engine is very important. You have to know whether the spider has come to your site, when you have been, which spider. These are good for your targeted optimization.

Many servers support spider crawl logs, but most webmasters are virtual machines, and some space does not support the record spider crawling. At this point we need to write code to record the behavior of spiders.

On the internet to find a lot of code is not used correctly, or the function is not perfect.

As long as you study. Summarize a set of code, hundred guaranteed to use.

!--? phpfunction Get_naps_bot () {$useragent = Strtolower ($_server[' http_user_agent ') if (Strpos ($useragent, ' Googlebot ')!== false) {return ' Googlebot ';} if (Strpos ($useragent, ' MSNBot ')!== false) {return ' MSNBot ';} if (Strpos ($useragent, ' slurp ')!== false) {return ' Yahoobot ';} if (Strpos ($useragent, ' Baiduspider ')!== false) {return ' Baiduspider ';} if (Strpos ($useragent, ' Sohu-search ')!== false) {return ' Sohubot ';} if (Strpos ($useragent, ' Lycos ')!== false) {return ' Lycos ';} if (Strpos ($useragent, ' Robozilla ')!== false) {return ' Robozilla ';} return false;} function Nowtime () {$date =date ("y-m-d.g:i:s"); return $date;} $searchbot = Get_naps_bot (), if ($searchbot) {$TLC _thispage = addslashes ($_server[' http_user_agent ']); $url =$_server[' Http_referer ']; $file = "Robotslogs.txt"; $time =nowtime (); $data =fopen ($file, "a"); $PR = "$_server[request_uri]"; Fwrite ($data, "Time: $time Robot: $searchbot URL: $TLC _thispage\n page: $PR \ r \ n"); fclose ($data);}? -->

The above code is more than the online version of a record search engine request page records, you can see the spider every time to crawl is that page. More conducive to the analysis of spiders on the weight of the site and the different columns and pages of the favor.

The ultimate SEO is to start from the actual, using data to speak, rather than imagination. All optimizations are based on data, and all optimizations are designed to get the data.

  • 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.