PHP Script to Fetch the Alexa Rank of a Website

Basically, Alexa rank is the frequency of visits on a particular website. Lower Alexa rank means more traffic volume to that website. Its ranking system is based on information collected from users who have installed its toolbar.

In this post, I will show you to fetch the Alexa rank of a particular website using a simple PHP script. To get the alexa rank, all you need to do is pass the URL of website to getAlexaRank() function. The function will return the rank which can be further stored inside a variable or in the database, or can be simple displayed on screen.

//PHP Script to Fetch Alexa Rank
function getAlexaRank($url){
	$xml = simplexml_load_file(''.$url);
	return $rank;
echo getAlexaRank('');

Useful Read: Unzip a file with php


Leave a Comment.