PHP query prvalue_php tutorial

Source: Internet
Author: User
PHP queries the prvalue of a website. Prvalue is one of the important criteria for google to measure websites. get the prvalue based on the results provided by google, such as toolbarqueries.google.com. hktbr? Clientnavclient-autoqinfo: phpddt. comlt ;? The prvalue is one of the important criteria for google to measure the website. The prvalue is obtained based on the results provided by google, such:
Http://toolbarqueries.google.com.hk/tbr? Client = navclient-auto & features = Rank: & q = info: phpddt.com & ch = 8fabc62ea

The code is as follows:


/*
* Function: encode the URL
* Parameter description: $ web_url URL, excluding "http ://"
*/
Function HashURL ($ url)
{
$ SEED = "Mining PageRank is against google's terms of service. Yes, I'm talking to you, scammer .";
$ Result = 0x01020345;
For ($ I = 0; $ I {
$ Result ^ = ord ($ SEED {$ I % 87}) ^ ord ($ url {$ I });
$ Result = ($ Result> 23) & 0x1FF) | $ Result <9;
}
Return sprintf ("8% x", $ Result );
}

/*
* Function: obtain pagerank based on the pr query interface provided by google.
* Parameter description: $ domain website domain name, excluding "http ://"
*/
Function pagerank ($ domain)
{
$ StartURL = "http://toolbarqueries.google.com/tbr? Client = navclient-auto & features = Rank: & q = info :";
$ GoogleURL = $ StartURL. $ domain. '& ch ='. HashURL ($ domain );
Echo $ GoogleURL .'
';
$ Fcontents = file_get_contents ("$ GoogleURL ");
$ Pagerank = substr ($ fcontents, 9 );
If (! $ Pagerank) return "0"; else return $ pagerank;
}
Echo pagerank ("phpddt.com ");
?>

License http://toolbarqueries.google.com.hk/tbr? Client = navclient-autoq = info: phpddt. comlt ;?...

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.