I need some help in PHP to create short urls just like StackOverflow creates when we comment any long URL in comments on a question.
StackOverflow shortens http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html long url to short urls like this noupe.com/...
I require similar kind of functionality in my application. Can anyone give some idea or code how to do that in PHP?
I tired searching it on StackOverflow but not found any question. I remember I had seen such type of question on SO, but right now I am not able to find it 🙁
Please help!
Just an outline of a simplistic algorithm.
http://orhttps://at the beginning withstr_replace./and only keep the first item in the returned array./...at the end.www.at the begining withstr_replace.With this found string, naming it
[shortURL], you compose your anchor: