Skip to content

Instantly share code, notes, and snippets.

Last active January 8, 2021 06:50
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
$source = file_get_contents('');
//Alexa Rank
preg_match('/\<popularity url\="(.*?)" text\="([0-9]+)" source\="panel"\/\>/si', $source, $matches);
$aresult = ($matches[2]) ? $matches[2] : 0;
//Alexa Sites Linking in
preg_match('/\<linksin num\="([0-9]+)"\/\>/si', $source, $asli);
$alinksin = ($asli[1]) ? $asli[1] : 0;
//Alexa US Rank
preg_match('/\<country code\="US" name\="United States" rank\="([0-9]+)"\/\>/si', $source, $rankus);
$usrank = ($rankus[1]) ? $rankus[1] : 0;
//Alexa Reach Rank
preg_match('/\<reach rank\="([0-9]+)"\/\>/si', $source, $reachr);
$areach = ($reachr[1]) ? $reachr[1] : 0;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta name="robots" content="NOINDEX, NOFOLLOW" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Alexa Rankings</title>
<style type="text/css" media="screen">
body {background-color: #999; font-family: Arial, sans-serif; color: #004C9C;}
h1 {text-align: center;}
table {width: 50%; margin: 0 auto; font-size: 14pt;}
tr {line-height: 2;}
td {padding-left: 5px;}
#outer {width: 100%;}
#inner {width: 50%; margin: 0 auto; background-color: white; padding: 50px; border: 1px solid #333;}
.blue {background: #E6ECF2;}
.yellow {background: #FFFF99; }
<div id="outer">
<div id="inner">
<h1>Alexa Rankings</h1>
<tr class="blue">
<td>Alexa Global Rank:</td>
<td><strong><?php echo $aresult; ?></strong></td>
<tr class="yellow">
<td>Alexa Sites Linking In:</td>
<td><strong><?php echo $alinksin; ?></strong></td>
<tr class="blue">
<td>Alexa U.S. Rank:</td>
<td><strong><?php echo $usrank; ?></strong></td>
<tr class="yellow">
<td>Alexa Reach Rank:</td>
<td><strong><?php echo $areach; ?></strong></td>
Copy link

This code does not run on the server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment