您的位置:首页 > 其它

长网址转换为短网址

2016-07-29 16:26 274 查看
50r.me 转换
https://50r.me/users/stats
新浪短网址接口的稳定性和跳转速度还是很给力的,现给出其API说明。
http://open.weibo.com/wiki/Short_url/shorten
该接口支持两种返回格式:xml和json

对应的URL请求地址为:

xml:http://api.t.sina.com.cn/short_url/shorten.xml

json:http://api.t.sina.com.cn/short_url/shorten.json

请求方式:GET

请求参数:

  source:应用的appkey

  url_long:需要转换的长链接

举个例子:

xml:http://api.t.sina.com.cn/short_url/shorten.xml?source=3271760578&url_long=http://www.douban.com/note/249723561/

返回内容为:

<urls>

     <url>

          <url_short>http://t.cn/zWXySpZ</url_short>

          <url_long>http://www.douban.com/note/249723561/</url_long>

          <type>0</type>

     </url>

</urls>

json:http://api.t.sina.com.cn/short_url/shorten.json?source=3271760578&url_long=http://www.douban.com/note/249723561/

返回内容为:

[{"url_short":"http://t.cn/zWXySpZ","url_long":http://www.douban.com/note/249723561/","type":0}]

  

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  短网址