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->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);
** Update **
Hey guys, some of you have said the script does not work anymore. You are correct, Google updates the algorithm that allows or disallows clients from getting the page rank. I fiddled around with it for a while and found a page rank script that does work http://home.zhiwei.li/pagerank/ and I also modified the GooglePageRank class to include the new algorithm. index.php source and google_pagerank.class.php source
The reason why I have disabled the demo from functioning is that it is against Google’s Terms of service to mine Page Rank. So I do not want to prod Google’s server with my server. I am not positive if this is actually against the TOS since this particular script is not exactly mining the data, just getting the data like a toolbar would- one site at a time.
You can also try the HM2K Pagerank script

Hello
This class not work :(
What is the error you are getting?