Google PageRank Script

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.

Update: The PageRank script has been relaunched as part of the PageRank Viewer website.

126 Responses to Google PageRank Script

← Older Comments
  1. David Vincent says:

    Hi, I have 7 servers at HostGator, but the script dos not work on any of them !!!!
    Just return a blank page… :(
    If anyone have a solution… Thx

  2. Rednex says:

    I wanted the pagerank to be shown as a number, so i modified last two lines like simly like this: echo pagerank($url);

  3. gosc says:

    I have errors:
    A PHP Error was encountered

    Severity: Warning

    Message: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known

    Severity: Warning

    Message: fsockopen() [function.fsockopen]: unable to connect to :80 (php_network_getaddresses: getaddrinfo failed: Name or service not known)

    I have save_mode = off… Can anyone help ?

  4. pagerank says:

    thanks.
    very nice script.

  5. acy says:

    Hey very nice script so far! Helps me very much!
    I was wondering if there is a way to implement a possibility to get around the time limit. I use this function in a small pagerank bach checker and canÄt handle more than ~100 urls. I think the main reason is the time limit. I there a way to get around this?

  6. cipikahn says:

    Very good script ! Thank you very much for sharing.

  7. Very nice work with the hasing, thanks for sharing, man!

  8. Swapnil says:

    Hi.. Admin
    your script is the best… the best … the best…. no other words… thanks for. I upload this script on site http://WWW.checkpagerank.co.nr Its working absolutely fine … but I am not a web master or I don’t know about php very well I am system administrator. so can u plz help me for making a scrip. I want users can copy result (image result url) for past on there site.
    like prchecker(.)info domain. so plz help me thanks…

  9. Pingback: PHP PageRank Checker * Update | Ajax and PHP Web Developer Blog

  10. andrea says:

    Thank you,

    it helped me a lot using that script.

    Now I have to figure out the way to use it on more than 1000 urls a day.

  11. url2c says:

    Very nice work with the hosting

  12. Bionic Candy says:

    it works like a charm. thanks for publishing the script.

  13. Roman says:

    Thank you!!!
    I am happy today :)

  14. m4st3r says:

    at last ! it works ! big THX !

  15. Maigrir Vite says:

    The script seems to work fine in my server. It is fast a very accurate. Thank you!

  16. Carl Silva says:

    At last a pr checker that works!!!

    Thanks a lot for your effort, after 4 years the script still works without flaws. Amazing.

  17. sugi says:

    GJ bro..Thank you..

  18. toni says:

    thanks for sharing this script. Regards!

  19. Chamberlain Web Solution says:

    Thank for sharing the code!

  20. Vijay says:

    There is this site in .ch domain which has perl program to check PR , pretty neat!

  21. James Wade says:

    In August Google checked the way they do lookups and expired their old methods.

    You need to update any references that say:
    toolbarqueries.google.com/search
    and
    http://www.google.com/search

    to
    toolbarqueries.google.com/tbr

    Alternatively, you can find the latest pagerank scripts here:

    https://github.com/phurix/pagerank/

  22. Ava Gardners says:

    Just check the demo URL, Work perfectly. How to add another data like backlink ? domain fake or valid PR ? etc

  23. Evan Cohen says:

    Nice script! Change the title of the page though (“RageRank” should be “PageRank”) to increase relevancy in a search. Kind of ironic, yeah?

    -Evan

  24. James Wade says:

    Well spotted Evan, I’ll update it now.

← Older Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>