PHP obtains website Alexa, google, baidu, and PR.

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

 

 

 
 
  1. Error_reporting (0 );
  2. Require 'Lib/Snoopy. class. php ';
  3. Require 'Lib/SEO_RankChecker.php ';
  4. Require 'Lib/WebCrawl. class. php ';
  5. If ($ _ REQUEST ['URL'])
  6. {
  7. $ U = $ _ REQUEST ['URL'];
  8. $ D = preg_replace ('/http \: \ // si', ', $ _ REQUEST ['URL']);
  9. $ U = 'http: // '. $ d;
  10. $ Info = array ();
  11. $ Go = new WebCrawl ($ u );
  12. // Obtain the website title, keyword, and other information
  13. $ Info = $ go-> getWebinfo ();
  14. $ Rank = new SEO_RankChecker ($ u );
  15. $ Info ['Alexa'] = (int) $ rank-> getAlexaRank ();
  16. $ Info ['Google '] = (int) $ rank-> getIndexedGoogle ();
  17. $ Info ['baidu'] = (int) $ rank-> getIndexedBaidu ();
  18. $ Info ['PR'] = (int) $ rank-> getPagerank ();
  19. $ Info ['status'] = "OK ";
  20. Echo json_encode ($ info );
  21. }
  22. ?>

 

Full package:

Click to download the attachment

Article Source: http://www.oschina.net/code/snippet_139172_10599

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.