Sep 13, 2011
In Web Programming
Recently for a project which I was working on, I wanted a way to expand urls shorted by url shorteners.
After a couple of web searches I found an API site called LongURL. This service was really slow and I had to look for alternatives.
I thought of writing my own using curl and then parse the headers. I was searching for the curl functions in PHP Manual and I found a simple but not so famous function called get_headers().
This function is all we need to expand the urls. The following function
expand_url() takes a short url and will return the longer version of the url.
Posted in Web Programming
Tagged Bit.ly, PHP, Url