Google RageRank Script
Update: See this script in action at pagerankviewer.com
The Google PageRank is a scoring system created by Google to give websites a rank. Generally, the more popular your website is, the higher your pagerank is.
Google offers the pagerank lookup in a number of places including on their directory and on their toolbar. It wasn’t long before webmasters wanted to monitor or display their pagerank.
The idea of this is so you can display the Google pagerank of a website. This is mainly a webmaster tool, regular uses generally have little use for such information.
To begin with I found googlecommunity.com which offered an on-site pagerank lookup tool, the tool was offered as closed source and consequently created quite a presence in the industry because of this. Some time later, googlecommunity.com released the source code, which matched the source code found on the MobileRead Networks forum, which is where the original source code came from.
I used this script for quite some time, however over time I began using a combination of web servers with different operating systems and with different versions of apache and php.
I discovered that when I used this script on one server it would work fine, yet when I used it on another I discovered that google would throw me back a 403 – Forbidden error. At first, like others I believed this was due to google blocking the IP ranges of my servers therefore preventing abuse of the service.
This was wrong. I soon discovered this after checking the checksum generated by the toolbar, then the checksums generated on working servers and non-working servers.
The main issue was that my development server was running on a different platform than my production server. I discovered that the problem was down to the way the “ch” is generated by certain versions of PHP, and the way they handle bitwise operations.
The solution was to either use a perl script and pass the details back and forth via a PHP script, but this would be a very dirty way of doing what we want. The best option would be to produce a native PHP script that would function on all servers.
I tried to revive this concept in a number of places in an attempt to get a functional solution. I went back to where it began on the MobileRead Networks forum Pagerank thread. A user named “AboutSledge” offered a working solution, which was the Pagerank Checksum Caculator Source Code for Python, for C and for PHP.
This script works well, and have not experienced a problem generating a checksum. As a result of this I have created a user friendly script which uses the same algorithm which means you can display the pagerank on your site.
- Download PHP PageRank Lookup script.