获取新浪微博的Tiny网址链接
程序员文章站
2024-01-29 10:16:46
...
///////////////////////////////////////////////////////////////////////获取新浪微博的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 新版
//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网址链接
//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 新版
function GetTurl($url=''){
set_time_limit(0);
//$tApi="https://api.weibo.com/2/short_url/shorten.json?access_token=[你的token]&url_long=";
$tApi="https://api.weibo.com/2/short_url/shorten.json?source=[你的appkey]&url_long=";
$tApi=$tApi.urlencode($url);
$ret=file_get_contents($tApi);
$ret=json_decode($ret,true);
if($ret['error']) return $url;
if(is_array($ret['urls'])){
$r= $ret['urls'][0]['url_short'];
return $r;
}
return $url;
}
来自: http://www.55lm.net/
AD:真正免费,域名+虚机+企业邮箱=0元
推荐阅读
-
获取新浪微博的Tiny网址链接
-
新浪微博Oauth2.0授权 获取Access Token以及API的使用
-
把wordpress文章分享到微博或twitter后, 如果获取weibo或twitter链接下的评论到WP
-
java调用新浪长连接转短链接api--新浪微博Oauth2.0授权 获取Access Token
-
使用java代码获取新浪微博应用的access token代码实例
-
Python 获取新浪微博的最新公共微博实例分享
-
Python 获取新浪微博的最新公共微博实例分享
-
[IOS]——获取新浪微博的.json数据
-
新浪微博如何获取我关注的人的微博的?
-
获取新浪微博的微博秀内容存入数据表中