《新浪短網址API接口》要點:
本文介紹了新浪短網址API接口,希望對您有用。如果有疑問,可以聯系我們。
相關主題:PHP開發
新浪短網址接口的穩定性和跳轉速度還是很給力的,現給出其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.fzlkiss.com/jiaocheng/14521.html
返回內容為:
<urls> <url> <url_short>http://t.cn/RucE4jb</url_short> <url_long>http://www.fzlkiss.com/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.fzlkiss.com/jiaocheng/14521.html
返回內容為:
[{"url_short":"http://t.cn/RucE4jb","url_long":"http://www.fzlkiss.com/jiaocheng/14521.html","type":0}]