PHP PageRank Checker

Posted on January 30th 2009 12:18pm Friday, by Blaine

This PageRank checker code has everything you need for a working php page rank checker.

<?php $site=$_POST['site']; ?>
<form action="test.php" method="post">
<input type="text" name="site" value="<?= empty($site)?'http://www.google.com/':$site; ?>">
<input type="submit" value="Check My PageRank!">
</form>

If you want to set your cache directory the popstats page rank class has a directive that you can set called CACHE_DIR. CACHE_DIR can be set
using the define function below.

define(CACHE_DIR,'inc/pagerank/cache/');

Popstats PHP PageRank class is so easy to use that 4 lines takes care of retrieving the page rank.

require_once("inc/pagerank/google_pagerank.class.php");
$rankObject = new GooglePageRank($site);
$pageRank = $rankObject-&gt;pagerank;
echo 'Page Rank of '.$pageRank;

That’s it!

However, if you want to change from the default caching period which is 24 hours (86600 seconds), just change the class call to however many seconds you want it to cache for.

$rankObject = new GooglePageRank($site,259800);

2 Responses to “PHP PageRank Checker”

  1. Hello
    This class not work :(

  2. Tommy Hilfiger on May 7th, 2010 at 6:12 am
  3. What is the error you are getting?

  4. Blaine on May 7th, 2010 at 11:55 am

Leave a Reply