PHP Program test page is included in Baidu

Source: Internet
Author: User

Recently to do a collation of the site, you need to detect which pages are not Baidu search engine included in the relevant adjustments. Because the use of SITE commands to see is really is not to see, think of the use of PHP program to batch processing, research, and found in fact very simple, the following will be the author of the use of PHP to achieve the test page is included in the function of Baidu to share.

Here is the specific code:

<?php
*
* Check whether the Web page is included in Baidu, return 1 is included in the return of 0 said not included
* @ param string $url to be detected URL * *
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;
    }   

Meaning is very simple, such as the need to detect http://www.Alixixi.com/javascript-function/833.html this site is included, you only need:

Checkbaiduinclude (' http://www.Alixixi.com/javascript-function/833.html ');

The result is to see for yourself.



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.