|go ahead... be a heretic|
Shorten Url/Link Paramby hankcoder (Beadle)
|on Dec 05, 2017 at 05:53 UTC||Need Help??|
hankcoder has asked for the
wisdom of the Perl Monks concerning the following question:
I would like to convert a long url or long link parameter string into short url or short string. I have tried using WWW::Shorten 'TinyURL' but it will remotely connect to external server for some reason. Furthermore, the shorten url will always have tinyurl.com prepended which I would like to use my own so I can fully take control how to manage url.
Is it possible to do this shortening task internally? My main reason is I created my own url link to my own page but it contain some long encoded strings. Eg http://www.mydomain.com/?p=bXlhYw&id=y0iBICSYQigrA360MaaZsSSENSXl7NvBxnqT7NGcYqN5maZoajyfrChAmTdtOfmMbkhIAhK3X9P4UQ5rDQrBcg&sg=i4QvLhtsmValqs4k5hEMjQ I would like to make it a kind of short "alias" so it looks better for user eg http://www.mydomain.com/?short=[short encoded params]
I also tried using Short::URL but it takes integer value instead of a string. Perhaps I'm not quite understand how to use this encode statement my $encoded = $su->encode(10000);
I also tried to find some long string encoding method but to not avail.
Could anyone please give me some suggestions or any better solutions to this. Your help are greatly appreciated. Thanks.