Php checks whether the page is indexed by Baidu, and php checks the page for indexing. Php checks whether the page is indexed by Baidu. php checks whether the page is indexed by Baidu search engine recently. Because you use site life php to check whether the page is indexed by Baidu, php checks the page for inclusion
Recently, it is necessary to check which pages on the website are not indexed by Baidu search engine for relevant adjustments. BecauseSite commandI thought of using the php program for batch processing. after studying it, I found that it is actually very simple, the following describes whether the detection page implemented by php is indexed by Baidu.
The code below is as follows:
<? Php/** check if the webpage is indexed by Baidu. if "1" is returned, 0 is returned. * @ param string $ url: the url to be checked */function checkBaiduInclude ($ url) is not included) {$ url = 'http: // 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, the need to detect the http://www.bkjia.com/article/74039.htm URL is indexed, you only need:
CheckBaiduInclude (http://www.bkjia.com/article/74039.htm ');
The returned result is 1. If it is 0, it is not included.
This article introduces this. There are also related articles on the website for you to learn and hope to help you learn.
Baidu recently needs to check which pages on the website are not indexed by Baidu search engine for relevant adjustments. Because of the use of site life...