Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Shorten Url/Link Param

by thomas895 (Deacon)
on Dec 05, 2017 at 06:41 UTC ( [id://1204930]=note: print w/replies, xml ) Need Help??


in reply to Shorten Url/Link Param

There are a variety of ways to accomplish this. The most straight-forward way is to run some free/open source URL shortener elsewhere on your server, and have your application use its API to generate short links.
Another way is to make a table in your database mapping some kind of ID (could be a SHA-1 of the original URL or state, or some kind of unique ID, or ...) to the URL or application state. When loaded, load that state and continue from there.

-Thomas
"Excuse me for butting in, but I'm interrupt-driven..."

Replies are listed 'Best First'.
Re^2: Shorten Url/Link Param
by hankcoder (Scribe) on Dec 05, 2017 at 08:24 UTC

    Thanks for reply Thomas. So the actual shorten url method is just an unique ID pointing to the long Url/string that being associated to? If this is the case, then I have misunderstood the whole "shortening" method wrongly. I thought it is some kind of encoding and decoding method.

    Could you further clarify on this? Generating a unique random short string and associating it to my long url/string is pretty much straight forward.

      Yes, this is a translation process not encode/decode. It is not possible to compress (encode) a long URL into a much shorter one and have enough information to recreate the long URL from only the very short URL. There needs to be a translation hash table. For reference see Wiki Tiny Url.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204930]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 02:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found