Ok usefull function for many people. After some googling I give you the easiest way to get the alexa rank:

<?
$url="toolspot.org";
function getAlexa($url)
{
	$xml = simplexml_load_file('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$url);
	$rank=(int)$xml->SD[1]->POPULARITY->attributes()->TEXT;
	$web=(string)$xml->SD[1]->POPULARITY->attributes()->URL;
	return $rank;
}
echo $url." has Alexa Rank ".getAlexa($url);
 
 
	function alexaRank($domain)
	{
		$remote_url = 'http://data.alexa.com/data?cli=10&dat=snbamz&url='.trim($domain);
		$search_for = '<POPULARITY URL';
		$part='';
		if ($handle = @fopen($remote_url, "r")) {
		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];
	}
echo "Alexa ranking: " . alexaRank("toolspot.org");
 
?>

The first way was pointed out to me by Sunny (see comments) and it’s cleaner and prettier. So use that.