URL Shortener makes a short version of a long given URL. There are many URL shorteners out there like bit.ly, tinyurl or is.gd. Of course we can use their API to create short urls, but it’s not interesting for developers, who want to look into the very deep of the mechanism.
Short url often has structure: , where hash is a string (unique) for a long url. Hash contains only digits and letters. In some cases letters are case sensitive.
Short url services like bit.ly, tinyurl are very helpful to make a short version of our long urls. In some cases, we want to expand short url to make sure it has been shortened correctly, or to check if someone gives us a harmful link. Expanding short url to long url using PHP is easy as we’ll see in this article.