/ Published in: PHP

Getting alexa rank is simple, a data link provide by alexa only needs the domain name and then it return xml data including the rank we want, so I make a php function to do this task.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? function Get_Alexa_Rank($domain) { $alexa = "http://data.alexa.com/data?cli=10&dat=s&url=%s"; return FALSE; } $nodeAttributes = $xml->SD[1]->POPULARITY->attributes(); $text = (int) $nodeAttributes['TEXT']; return $text; } //example: echo "The alexa rank for Google is :". Get_Alexa_Rank('google.com') ."<BR>"; echo "The alexa rank for blogger is :". Get_Alexa_Rank('blogger.com') ."<BR>"; ?>
URL: http://function-code.blogspot.com/2014/10/get-alexa-rank-using-php.html
Comments
