加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

新浪短网址API接口

发布时间:2020-12-13 02:02:39 所属栏目:PHP教程 来源:网络整理
导读:《新浪短网址API接口》要点: 本文介绍了新浪短网址API接口,希望对您有用。如果有疑问,可以联系我们。 新浪短网址接口的稳定性和跳转速度还是很给力的,现给出其API说明。 该接口支持两种返回格式:xml和json 对应的URL请求地址为: xml:http://api.t.sina

《新浪短网址API接口》要点:
本文介绍了新浪短网址API接口,希望对您有用。如果有疑问,可以联系我们。

新浪短网址接口的稳定性和跳转速度还是很给力的,现给出其API说明。
该接口支持两种返回格式: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 ,这里 3271760578 或 31641035 还可以用哦。如果你不想申请就直接用吧。

  url_long:需要转换的长链接

举个例子:

(1)XML格式:
http://api.t.sina.com.cn/short_url/shorten.xml?source=3271760578&url_long=http://www.52php.cn/jiaocheng/14521.html
返回内容为:

<urls>
       <url>
              <url_short>http://t.cn/RucE4jb</url_short>
              <url_long>http://www.52php.cn/jiaocheng/14521.html</url_long>
              <type>0</type>
       </url>
</urls>

(2)json格式:

http://api.t.sina.com.cn/short_url/shorten.json?source=3271760578&url_long=http://www.52php.cn/jiaocheng/14521.html
返回内容为:

[{"url_short":"http://t.cn/RucE4jb","url_long":"http://www.52php.cn/jiaocheng/14521.html","type":0}]

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读