toreac.blogg.se

Make a tinyurl
Make a tinyurl












  1. MAKE A TINYURL FULL
  2. MAKE A TINYURL SOFTWARE

MAKE A TINYURL SOFTWARE

There is really no excuse for Twitter not developing and utilizing its own service for this purpose.Designing a URL shortener such as TinyURL and Bitly is one of the most common system design interview questions in software engineering. You could even make money off of it by building in small advertisements that would automatically display on the page that you’ve redirected to. Everything can be done through secure POST queries if you write it correctly. If you aren’t going to let someone send queries across servers, then you don’t need secure widgets that allow GET queries to run. In Twitter’s case, if they were going to use the service completely in-house, there wouldn’t really be a need for that. Sure, it might take a bit longer to get secure widgets and everything designed so that users could automatically generate shorter URLs the way Twitter does, but that shouldn’t stop someone from trying. If you want to make money off of it, then, instead of using a redirect script, you simply load the real URL inside of an iFrame and place a random advertisement somewhere on your home page. You’ve got your very own TinyURL service. Then, query the database for the real URL that matches up with that number and put the database result inside of a header redirect (Response.Redirect or header(“Location: $myresult”) or similar).īam! You’re done.

make a tinyurl

If it hasn’t, you generate a random number, encrypt it using something like md5, shorten it to 6-8 characters, check to make sure that alias has not been used before, place it in the database alongside the real URL and then you’re more than halfway there.įrom there, you simply use ht rewrite (or something similar) to give yourself the URLs that they offer, and have all of them redirect to index.php (or index.asp or pl or cgi or whatever server-side language you want to use) with a query string showing the random, encrypted number that coincides with the URL. If it has, you pull the alias you’ve already generated and return that.

MAKE A TINYURL FULL

Grab the full URL from a form (like TinyURL does) and query the database to see if that URL’s been entered before. The way I see it, I think it would probably take about 15 minutes to write a script that would do the same thing it does, and another 15 minutes to design and implement a much nicer site through which the users would shorten their links.Īll you need is a database and a server-side language. I’m also curious – what’s so special about TinyURL. Is all of the site’s income based strictly on donations? I’ve always kind of wondered – how does TinyURL make any money? I’m sure, with over 47 million URLs that have been shortened, the TinyURL server must have to put up with at least a slightly above-average amount of bandwidth (which isn’t cheap, as you all probably know). Why hasn’t Twitter developed its own URL-shortening service? What’s so difficult about it? He pointed out that Twitter really ought to develop a URL-shortening service of its own, rather than relying on TinyURL.Īs I said, that got me thinking. The point Allen made was that, by doing so, Twitter was completely at the mercy of TinyURL’s server, and, if the TinyURL site ever went down for any reason (or, God forbid disappeared entirely) Twitter would be up the creek without a paddle (paraphrasing there). The article was about Twitter using a service like TinyURL to shorten all links posted on Twitter.

make a tinyurl

I was reading an article on CenterNetworks the other day, and it got me thinking.














Make a tinyurl