Home >php教程 >php手册 >获取新浪微博的Tiny网址链接

获取新浪微博的Tiny网址链接

WBOY
WBOYOriginal
2016-06-07 11:41:211596browse

///////////////////////////////////////////////////////////////////////获取新浪微博的T网址链接
//http://open.weibo.com/wiki/2/short_url/shorten
//http://open.weibo.com/wiki/Help/error
//http://open.weibo.com/wiki/2/account/rate_limit_status 新版
    ///////////////////////////////////////////////////////////////////////获取新浪微博的T网址链接<br>     //http://open.weibo.com/wiki/2/short_url/shorten<br>     //http://open.weibo.com/wiki/Help/error<br>     //http://open.weibo.com/wiki/2/account/rate_limit_status 新版<br>     function GetTurl($url=''){<br>         <br>         set_time_limit(0);    <br>         //$tApi="https://api.weibo.com/2/short_url/shorten.json?access_token=[你的token]&url_long=";<br>         $tApi="https://api.weibo.com/2/short_url/shorten.json?source=[你的appkey]&url_long=";<br>         $tApi=$tApi.urlencode($url);        <br>         $ret=file_get_contents($tApi);<br>         $ret=json_decode($ret,true);<br>         if($ret['error']) return $url;<br>         if(is_array($ret['urls'])){<br>             $r= $ret['urls'][0]['url_short'];<br>             return $r;<br>         }<br>         return $url;        <br> <br>     }<br> <br> 来自: http://www.55lm.net/

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn