Using the Google Safe Browsing API to check shorter urls.

I’ve been wondering for a while how many of shortner’s short urls would lead to a site containing malware.

Luckely the Google is here lending a helping hand when checking for bad urls.

In short/simple terms the google safe browsing api lets you download a set of hashes of urls that contain nasties and updates to keep that list you have locally up to date.
After that you can create a list of possible urls to check against.. create md5 hashes of those.. and then check those against that list you have. If you get a hit.. the big chance the url contains some form of malware or another. Now I don’t want my users to end up on a site with malware so I can stop the redirect and give people the choice to continue or not.

Anyway. More information on this awesome thing you can find over here: 

Oh and thanks Google for putting this awesome thing out there for developers to use to protect their users.