PHP Check page is included in Baidu, PHP check page included
Recently need to detect which pages in the site is not indexed by Baidu search engine to make relevant adjustments. Because of the use of the site command to see the fact is not to see, I think of the use of PHP programs to batch processing, research, and found that in fact very simple, the following will be the implementation of the PHP test page is included in the function of Baidu share.
Here is the specific code:
<?php/* * Detect whether the webpage is included in Baidu, return 1 is included return 0 means not included * @ param string $url The URL to be detected */function Checkbaiduinclude ($url) { $url = ' h Ttp://www.baidu.com/s?wd= '. $url; $curl =curl_init (); curl_setopt ($curl, Curlopt_url, $url); curl_setopt ($curl, curlopt_returntransfer,1); $rs =curl_exec ($curl); Curl_close ($curl); if (!strpos ($rs, ' Sorry, not found ')} { return 1; } else{ return 0;
The meaning is very simple, for example need to detect http://www.bkjia.com/article/74039.htm this URL is included, then only need:
Checkbaiduinclude (http://www.bkjia.com/article/74039.htm ');
The back result is 1 for ingest. The 0 is not included.
This article introduces to this, the website also has the related article for everybody to study, hoped that everybody's study has the help.
http://www.bkjia.com/PHPjc/1065570.html www.bkjia.com true http://www.bkjia.com/PHPjc/1065570.html techarticle PHP Check whether the page is included, PHP check page included recently need to detect which pages in the site is not indexed by Baidu search engine to make relevant adjustments. Because of the use of site life ...