After posting on how to automatically shorten URLs with TinyURL using its API which provided extra long URLs, I discovered is.gd. Its another URL shortening service. The URLs will be 18 characters or less, including the beginning http://.
We will create a simple function, and in that we will use the file_get_contents() function which gets the data in a web page.
If you go to: http://is.gd/api.php?longurl=http://manmohanjit.com and view its source, it inputs the shortened URL right on the page with no Doctype clarification, so you just need to use the file_get_contents() PHP function to fetch the data on that page and input it on your page.
function isGD_URL($url) {
$isgd = file_get_contents('http://is.gd/api.php?longurl='.$url);
return $isgd;
}
Now you can choose either to use TinyURL or is.gd to shorten your URLs.
No comments
No comments yet...