bit.ly 短地址转换
One of the more popular URL shortening services is Bit.ly. I've showed you how to create short URLs with TinyURL and Is.Gd, so why not show you how to create Bit.ly URLs remotely?
最受欢迎的URL缩短服务之一是Bit.ly。 我已经向您展示了如何使用TinyURL和Is.Gd创建短URL,那么为什么不向您展示如何远程创建Bit.ly URL?
PHP (The PHP)
/* make a URL small */
function make_bitly_url($url,$login,$appkey,$format = 'xml',$version = '2.0.1')
{
//create the URL
$bitly = 'http://api.bit.ly/shorten?version='.$version.'&longUrl='.urlencode($url).'&login='.$login.'&apiKey='.$appkey.'&format='.$format;
//get the url
//could also use cURL here
$response = file_get_contents($bitly);
//parse depending on desired format
if