://u.nu/jy0a
I was recently referred to another URL shortening website called u.nu. As far as shortening services go, u.nu seems to have the field beat as far as the shortest base URL. If you're really intent on creating the shortest possible URLs, look no further than u.nu's API.
最近,我被引荐到另一个网址缩短网站u.nu。 就缩短服务而言,u.nu似乎已经击败了最短的基本URL。 如果您真的想创建尽可能短的URL,请只使用u.nu的API。
PHP (The PHP)
function get_unu_url($url)
{
$url = 'http://u.nu/unu-api-simple?url='.urlencode($url);
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$url = curl_exec($ch);
curl_close($ch);
return trim($url);
}
$short_url = get_unu_url('https://davidwalsh.name');
//returns http://u.nu/92e
That's it. I love that there's no XML or JSON involved with their API. What's returned is the URL and nothing more!
而已。 我喜欢他们的API不涉及XML或JSON。 返回的是URL,仅此而已!
://u.nu/jy0a