Hello guys,
I developed a site and i need to query the Alexa rank of any requested website.
The code works for sometime and stops working for some days too.
This is my code
<?php
$url = 'http://data.alexa.com/data?cli=10&dat=snbamz&url=example.com';
$xml = simplexml_load_string(file_get_contents($url));
var_dump($xml);
?>
What it returned
object(SimpleXMLElement)#1 (2) { ["@attributes"]=> array(4) { ["VER"]=> string(3) "0.9" ["URL"]=> string(10) "alexa.com/" ["HOME"]=> string(1) "0" ["AID"]=> string(1) "=" } ["RLS"]=> object(SimpleXMLElement)#2 (2) { ["@attributes"]=> array(3) { ["TITLE"]=> string(13) "Related Links" ["PREFIX"]=> string(7) "http://" ["more"]=> string(1) "0" } ["RL"]=> object(SimpleXMLElement)#3 (1) { ["@attributes"]=> array(2) { ["HREF"]=> string(77) "www.alexa.com/blocker?tag=YpxpmjmpvjvxjUjxj=0000000000000&ref=data.alexa.com/" ["TITLE"]=> string(41) "Please click here to continue using Alexa" } } } }
But sometimes, it actually returns a well structured array and am able to get what i want from the array. But after some more queries, it goes back to this result above
Please how can i always get alexa to return the right results, As my website totally depends on it