PHP obtains website Alexa, google, baidu, and PR.
PHP high accuracy and high availability get website Alexa, google, baidu, PR information.
The subject code is as follows:
- Error_reporting (0 );
- Require 'Lib/Snoopy. class. php ';
- Require 'Lib/SEO_RankChecker.php ';
- Require 'Lib/WebCrawl. class. php ';
- If ($ _ REQUEST ['URL'])
- {
- $ U = $ _ REQUEST ['URL'];
- $ D = preg_replace ('/http \: \ // si', ', $ _ REQUEST ['URL']);
- $ U = 'http: // '. $ d;
- $ Info = array ();
- $ Go = new WebCrawl ($ u );
- // Obtain the website title, keyword, and other information
- $ Info = $ go-> getWebinfo ();
- $ Rank = new SEO_RankChecker ($ u );
- $ Info ['Alexa'] = (int) $ rank-> getAlexaRank ();
- $ Info ['Google '] = (int) $ rank-> getIndexedGoogle ();
- $ Info ['baidu'] = (int) $ rank-> getIndexedBaidu ();
- $ Info ['PR'] = (int) $ rank-> getPagerank ();
- $ Info ['status'] = "OK ";
- Echo json_encode ($ info );
- }
- ?>
Full package:
Click to download the attachment
Article Source: http://www.oschina.net/code/snippet_139172_10599