February 21, 2010

Erlang Code to UnShort Tiny Url’s

A simple erlang gen_server to return original url from short ones.

It accepts any kind of of url, retrieving zero or one redirect location.

Just copy the code and give it a test :

darkua:~ sergioveiga$ erl
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]

Eshell V5.7.4 (abort with ^G)
1> c(unshort_srv).
{ok,unshort_srv}
2> unshort_srv:start_link().
{ok,<0.39.0>}
3> unshort_srv:unshort(”http://tarpipe.com/kE”).
{ok,”http://sergioveiga.com/index.php/2010/02/21/erlang-code-to-unshort-urls/”}
4> unshort_srv:unshort(”http://google.com”).
{ok,”http://www.google.com/”}
5>

blog comments powered by Disqus