Hi, I want to show latest alexa ranking of multiple sites on my website. For example like this www-example-com 202021 www-example1-com 102343 www-example2-com 10234324 I need to use PHP code for this purpose. Can any body help in this regards.
// Find your alexa ranking public function Alexa($domain) { $remote_url = 'http://data.alexa.com/data?cli=10&dat=snbamz&url='.trim($domain); $search_for = '<POPULARITY URL'; if ($handle = @fopen($remote_url, "r")) { $part = null; while (!feof($handle)) { $part .= fread($handle, 100); $pos = strpos($part, $search_for); if ($pos === false) continue; else break; } $part .= fread($handle, 100); fclose($handle); } $str = explode($search_for, $part); $str = array_shift(explode('"/>', $str[1])); $str = explode('TEXT="', $str); return $str[1]; } PHP: Source: http://abcoder.com/php/get-google-page-rank-and-alexa-rank-of-a-domain-using-php/
Just for future reference, if there isn't an API available for another site in future, you could always use file_get_contents and regular expressions to get the information you need.