Php uses curl to check whether the page is indexed by Baidu. To sort out the website recently, you need to check which pages on the website are not indexed by Baidu search engine for relevant adjustments. Because the use of the site command lines is really not recently to sort out the website, you need to check which pages on the website are not indexed by Baidu search engine for relevant adjustments. Since the use of the site command lines is really not good, I thought of using the php program for batch processing, research, found that it is actually very simple, the following describes whether the detection page implemented by the author using php has been indexed by Baidu.
The code below is as follows:
The code is as follows:
/*
* Checks if the webpage is indexed by Baidu. if the returned value is 1, the system returns 0, indicating that the webpage is not indexed.
* @ Param string $ url the url to be detected
*/
Function checkBaiduInclude ($ url ){
$ 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.phpernote.com/javascript-function/833.html URL is indexed, you only need:
CheckBaiduInclude ('http: // www.phpernote.com/javascript-function/833.html'); check the result by yourself.
This article is reproduced from: PHP programmer notes
Bytes. Because I can't see it by using the site command...