2 minute read

Introduction

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.

The Original Source

To begin with I found:

This 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:

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.

The Problem

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

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.

The Update

Phurix sponsored the launched of a PageRank viewer site that uses the script

The Future

Is Google PageRank here to say? For now, the answer is yes…

The source code is now an official PHP PEAR package:

Comments