Here is a small PHP script that will loop through a array of domains or take a url argument and show the PR for those domains or a single domain. This uses a great PHP script created by MagicBeanDip for handling the XOR32 for calculating the PR. The PR class is then called and used while looping through the domain array. If you pass in a url paramter (ie: http://www.yourdomain.com/pr.php?url=http://www.anotherdomain.com, you’ll see the PR for that single domain only. I could see using this with some AJaX hooks to see how your domains are performing in regards to Google page rank.
Depending on your affiliate strategy, PR can be very important or a non-issue. I personally want my blogs and community sites to rank high, but affiliate store fronts, etc, I could care less, since I’m generally paying to get visitors there any way. It would be nice to get the PR love higher and get free organic traffic there, but at this particular juncture, I’m fine with straight arbitage.
// please download the entire script (I’ve excluded the PR class to keep this small)
$oPR = new PageRankXor32();
if(isset($_GET[‘url’])){
$url = $_GET[‘url’];
$PageRank = $oPR->getRank($url);
$dir = getcwd();
$filename = $dir."/images/pr-".$PageRank.".gif";
$handle = fopen($filename,‘r’);
$contents = fread($handle,filesize($filename));
header("Content-type: image/jpeg");
echo $contents;
fclose($handle);
}else{
$siteArr = array(‘http://www.domain1.com’,
‘http://www.domain2.com’,
‘http://www.domain3.com’,
‘http://www.domain4.com’,
‘http://www.domain5.com’,
‘http://www.domain6.com’,
‘http://www.domain7.com’,
‘http://www.domain8.com’);
echo "<table cellpadding=0 cellspacing=0 border=0 valign=\"top\">";
foreach($siteArr as $item){
$PageRank = $oPR->getRank($item);
//echo $PageRank."<br>";
$image = "images/pr-".$PageRank;
if($PageRank == ‘-1′){
$image = "images/pr-0";
}
echo "<tr>";
echo "<td valign=\"middle\">".str_replace("http://","",$item)."</td>";
echo "<td valign=\"middle\"><img src=\"".$image.".gif\"><br></td>";
echo "</tr>";
}
echo "</table>";
?>
The entire script and images have been zipped and can be downloaded here.
Related posts:
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.