Due to recent changes made by Google in its Page Rank processing the following library doesn’t work. However you can try to use the following api made available by fusionswift.com:
Mark Woodman has created a nifty class which lets you query Google pagerank info in PHP 5 and above. The complete classes are available here.
Sample code is shown below.
require_once("popstats/google_pagerank.class.php"); $rankObject = new GooglePageRank("http://www.someDomain.com"); $pageRank = $rankObject->pagerank; echo $pageRank;
The class also supports result caching on the local machine, so if a second query arrives within the cache time limit the result saved in the local file is returned rather then going out and querying Google.
The ‘GooglePageRank’ class accepts cache time as a second parameter. So if you want to cache the result for 6 hours you set the second parameter for 21600 seconds (6 * 60 * 60):
$rankObject = new GooglePageRank("http://www.someDomain.com", 21600);
The default is set to 24 hours, which is more then adequate for most purposes.