Shorten a URL

This example shows how to use tinyurl’s api to genearte a short url from a url you pass, there are other services which offer this functionality

 * Use tinyurl to generate a short url
 * @param string $url The url that you want to shorten
function ShortUrl($url)

$tinyurl = file_get_contents(“”.$url);
return $tinyurl;
//usage example
echo ShortUrl(““);


Please enter your comment!
Please enter your name here