TinyURL is a Web service that shortens URLs. It can turn long URLs into simple addresses. Usually, the way to create TinyURL is to go to its homepage to create it. Sometimes users automatically generate TinyURL on the client. Here is an introduction to how to create a TinyURL PHP calls TinyURL to generate a shortened address.
The PHP functions of TinyURL API are as follows
<?php
function TinyURL($u){
return file_get_contents('http://tinyurl.com/api-create.php?url='.$u);
}
?>
An example of calling is
<?php
$url = 'http://www.williamlong.info/';
$tiny = TinyURL($url);
echo('The TinyURL of "'.$url.'" is "'.$tiny.'"');
die();
?>
Reprinted from Moonlight Blog