PHP get Alexa website Ranking, traffic, volume of visits, page views code function sharing

Source: Internet
Author: User

Alexa Introduction

Alexa's web site has two main rankings: comprehensive rankings and category rankings.

Comprehensive rankings are also called Absolute rankings, that is, a particular site in all sites in the rankings. Alexa publishes a new website comprehensive ranking every three months. This ranking is based on the geometric average of the number of user links (the users Reach) and the page views three-month cumulative.

Category ranking, one is categorized by topic, such as news, entertainment, shopping, etc., Alexa gives a particular site in the same type of site ranking. Second, according to the language classification, currently divided into 20 languages, such as English website, Chinese website [Chinese (simpl) and Chinese (Trad)], and so on, give a specific site in all such language site rankings.

Alexa Rankings is a commonly cited indicator used to evaluate a site's traffic. In fact, Alexa rankings are based on the user download and install Alexa Tools Bar embedded in IE, Firefox and other browsers, so as to monitor their access to the site data statistics, therefore, its ranking data is not absolute authority. But because it provides the comprehensive ranking, the number of visits ranked, page visits ranking and other evaluation indicators information, and there is no and it is difficult to have a more scientific and reasonable evaluation reference.

Get Alexa site rankings, traffic, visits, page views

So, how does PHP get Alexa site rankings, traffic, volume of visits, page views?

  1. <?php
  2. /**
  3. * Get Alexa Rank
  4. *
  5. * @param Domain Name $Domain
  6. * @return Alexa Rank
  7. * @copyright Jsmile http://www.uedsc.com/
  8. */
  9. function Getalexarank ($Domain) {
  10. $line = "";
  11. $data = "";
  12. $URL = "Http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url=". $Domain;
  13. $fp = fopen ($URL, "R");
  14. if ($fp) {
  15. while (!feof ($fp)) {
  16. $line = fgets ($FP);
  17. $data. = $line;
  18. }
  19. $p = Xml_parser_create ();
  20. Xml_parse_into_struct ($p, $data, $vals);
  21. Xml_parser_free ($p);
  22. for ($i =0; $i <count ($vals); $i + +) {
  23. if ($vals [$i] ["tag"]== "popularity") {
  24. return $vals [$i] ["Attributes"] ["TEXT"];
  25. }
  26. }
  27. }
  28. }
  29. ?>

How to use:

    1. echo Getalexarank (www.uedsc.com);

PHP get Alexa website Ranking, traffic, volume of visits, page views code function sharing

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.