I was looking for an automated way to get Google Pagerank for a few hours and came up with quite a few things, but not many of them were very elegant. Essentially, Google doesn’t provide an API and it’s against their terms of service to hit them up in an automated way. I found quite a few places that have come up with close algorithms and calculate PR for sites, but that’s just not accurate enough for me. The other option is to hit their PR URL that the toolbar uses. For example:
That returns the PR of Digital Point Forums, where I found that information, but you can’t change the reference URL, because of a checksum. That’s the &ch= variable in the URL. I’m working on a project that needs to look up PR on the fly though, so that just won’t work. I ended up finding a script that I could use, but the guy didn’t put his URL in the comments, and I since can’t find it – oops. I think he deserves a pat on the back though. If this belongs to you, or you know who’s it is, let me know.
I tweaked the script and installed it on my Toolerific.com website. Now you can go there and check the PR of any site without a captcha, which is nice. The tool is here.
Now, the best automated way to check pagerank is to hit that site with cURL and take out the value of the HTML tag with the id “value”. The reason that is the best automated way to do it is because Google may change their checksum rules and that will break the source code that I used to generate it, but that site will always be laid out like that, so you don’t have to worry about changing anything. If you want the code I used, you can view it here.
Update: This doesn’t seem to work ALL of the time. I suspect it has something to do with the checksum, but can’t figure it out. Seems to be about 27% of the time, which isn’t great odds, but it works MOST of the time. I’ll keep you posted if I find out more.