Wednesday, July 15, 2009

How to get the tiny url using php code?

The following php code will generate the tiny urls


<?php

function getTinyUrl($url)
{
$tinyurl = file_get_contents("http://tinyurl.com/
api-create.php?url={$url}");
return $tinyurl;
}

$url="http://www.awesome-gallery-blogspot.com";
echo getTinyUrl($url);

?>



It will gives the url : http://tinyurl.com/ldq9aq


This will be useful when we are trying to post our url in different blog.
If we want more impressions without knowing the url name then we can use this function.

No comments:

Post a Comment