实现sina 微博 的短链接函数
/**
* 微博 短链接
*
*/
static public function sinaShortUrl($url)
{
$source = '118999789';
$apiUrl = "http://api.t.sina.com.cn/short_url/shorten.json?source=$source&url_long=".$url;
$result = json_decode(self::getCurl($apiUrl),true);
$shortUrl = $url;
if(!empty($result) && $result[0]['type'] == 0 && $result[0]['url_short']){
$shortUrl = $result[0]['url_short'];
}
return $shortUrl;
}