Php check page indexed by Baidu, php check page indexed _ PHP Tutorial

Source: Internet
Author: User
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...

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.