This function returns the Alexa rank by a given url.
You can use it in a web directory to diplay
the Alexa rank of the submited websites or
to output your own.
function getAlexaRank($aUrl)
{
$awsid = 'YourSubscriptionId';
$awsurl = 'http://aws-beta.amazon.com/onca/xml?Service=AlexaWebInfoService';
$awsurl .= '&SubscriptionId=' . $awsid . '&Operation=UrlInfo';
$awsurl .= '&ResponseGroup=Rank&Url=';
$awsurl .= $aUrl;
if ($aUrl)
{
$request = file_get_contents($awsurl);
preg_match('/<Rank>(d+)</Rank>/', $request, $match);
$rank = $match[1];
}
return $rank;
}