question

Dev Enam avatar image
Dev Enam asked

Fetch unlimited Alexa Website Rank with PHP

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

alexarequestphp
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers