PHP Code, SEO Optimization

How to get a page's Google PageRank (PR) with PHP

I was recently looking for an easy way to lookup the Page Rank for a given page, site or really any URL. I've seen lots of tools out that that can do it, and many of them allow you to integrate the tool into your site. But those require a lot of extra work, and they just really display the PR. I wanted to actually retrieve the value with PHP. Doing a quick search on google revealed a Google PageRank class from It seems to be pretty robust, and it looks like it will do the job!



  1. You may have implemented this already but it may serve as a useful reminder. If you are requesting the page rank for the same page repeatedly it doesn't make much sense to contact google again and again – pagerank only changes every few months.

    I wrote a little script a while ago speed things up by caching the result. Might be useful to you and/or your readers.

  2. That's a good point Jonathan, but I do believe that the class I linked to actually does allow caching

Leave a Reply

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

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image