A free URL forwarding api service allowing anyone to take any existing URL and shorten it. And it never expires
You can go to pgurl.com to generate your own short url or calling http request by following sample.
I using jquery as coding sample.
var getShortUrl = function(yoururl){
var rurl = "http://pgurl.com/shorturl/create/?lurl=" + encodeURIComponent(yoururl) + "&q=*";
$.get(url, function(txt){
console.log(txt);
//put your coding here
});
return false;
}
i use http://easydeveloperlife.blogspot.com/ as sample and the api return as bellow:-
pgurl.com/6e4ea
Now you can call the url and redirect to my blogs. I using hash algorithm to make sure the url will not repeat or redundancy. You can requesting the api by any system or any programming languages to get your shorturl works. No need programing the function again. Simple, right?
No comments:
Post a Comment