Nice work! Using the official APIs as much as possible is usually a good move because most shorteners not only use 301/Location header redirects, but often use pages with messages like "this page has been marked as spam, do you want to proceed?" and "this page returns a 404, want to go to our ad supported search engine to find a similar page instead?".
Of course the above is not universally true, and as someone who has implemented a similar library, I learned that most URL shorteners have various quirks. E.g., Is.gd does not tell you via their API[0] what the real url[1] of a blocked site is, and TinyURL (which has many[2] different[3] non-redirect[4] pages[5]) doesn't offer an API at all.
Why not just follow redirects instead? All proper URL-shortening services would work no matter of API. And just add support for those that does it via IFRAME. much more convenient.
5 comments
[ 3.6 ms ] story [ 24.6 ms ] threadedit: back up now.
Of course the above is not universally true, and as someone who has implemented a similar library, I learned that most URL shorteners have various quirks. E.g., Is.gd does not tell you via their API[0] what the real url[1] of a blocked site is, and TinyURL (which has many[2] different[3] non-redirect[4] pages[5]) doesn't offer an API at all.
0: http://is.gd/forward.php?format=simple&shorturl=mBAh 1: http://is.gd/mBAh 2: http://tinyurl.com/cs 3: http://tinyurl.com/w 4: http://tinyurl.com/dick 5: http://tinyurl.com/bvkke