PHP implementation query Baidu Google ingest situation (sample code) _php Tutorial

Source: Internet
Author: User
Wrote a small thing to record Baidu and Google for the site of the situation, can now query, in fact, there is no difficulty, that is, to file remote files, and then analysis.

On the seemingly check Google PR is just file an address, so said there is no difficulty.
The complete code is as follows, file obtains files, analysis, output:
Copy the Code code as follows:
$seodetail = Array ();
$domain =!empty ($_get[' Q ')? $_get[' Q ']: ' www.mycodes.net ';
Baidudetail ($domain);
Googledetail ($domain);
Var_dump ($seodetail);

function Baidudetail ($domain) {
$baidu _site = ' Http://www.baidu.com/baidu?word=site%3A '. $domain;
$baidu _link = ' Http://www.baidu.com/baidu?word=link%3A '. $domain;
$baidu _domain = ' Http://www.baidu.com/baidu?word=domain%3A '. $domain;
Getdetail ($baidu _site, ' baidu_site ', ' related pages ', ' articles, Time ');
Getdetail ($baidu _link, ' baidu_link ', ' related pages ', ' articles, Time ');
Getdetail ($baidu _domain, ' baidu_domain ', ' related pages ', ' articles, Time ');
}

function Googledetail ($domain) {
$google _site = ' Http://www.google.cn/search?hl=zh-CN&q=site%3A '. $domain;
$google _link = ' Http://www.google.cn/search?hl=zh-CN&q=link%3A '. $domain;
Getdetail ($google _site, ' google_site ', ' a result, ', ' A. (Search time ');
Getdetail ($google _link, ' google_link ', ' about ' , ' necklace received ');//102
}

function Getdetail ($url, $type, $WORDF, $wordb) {
$pagecontent = @file ($url);
$pagecontent = Implode (' ', $pagecontent);
$pagecontent = substr (Strstr ($pagecontent, $WORDF), strlen ($WORDF));
$pagecontent = Substr_replace ($pagecontent, ", Strpos ($pagecontent, $wordb));
Returndetail ($pagecontent, $type);
}

function Returndetail ($content, $type) {
Global $seodetail;
$seodetail [$type] = empty ($content)? 0: $content;
}
?>

http://www.bkjia.com/PHPjc/328091.html www.bkjia.com true http://www.bkjia.com/PHPjc/328091.html techarticle wrote a small thing to record Baidu and Google for the site of the situation, can now query, in fact, there is no difficulty, that is, to file remote files, and then analysis. Yes, it looks like ...

  • 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.