新浪短网址官方api接口
新浪短网址API接口
1.接口地址: http://www.wx-url.cn/sina.php?url_long=http://www.baidu.com
2.接口地址: http://dogdwz.cn/tcnjson?url=http://www.baidu.com
3.接口地址: http://www.sina-url.cn/xinlang?url=http://www.baidu.com
4.接口地址:http://www.wx-dwz.cn/tcnurl?url=https://www.baidu.com
5.接口地址:http://mhdwz.cn/mhsina?url=http://www.baidu.com
6.接口地址:http://maiyurl.cn/weibourl?url=http://www.baidu.com
http://sina-t.cn/api?link=http://baidu.com
http://tttool.cn/sina_api?url=http://baidu.com
http://knurl.cn/tcnapi?url_long=http://baidu.com
http://migourl.cn/sina_shorturl.html?text=http://baidu.com
http://lnurl.cn/sina/short?url_long=http://www.baidu.com
新浪短网址API说明
将以上新浪短网址api接口的"http://www.baidu.com"部分替换成您所需要的长链接即可生成对应的新浪短网址!
新浪短网址接口文档
PHP调用代码:
$url = ‘http://www.baidu.com‘; $api_url = ‘‘.urlencode($url); $short_url = file_get_contents($api_url); echo $short_url;
JAVA调用代码:
public static void main(String path[]) throws Exception { URL u = new URL("http%3A%2F%2Fwww.baidu.com"); InputStream in = u.openStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { byte buf[] = new byte[1024]; int read = 0; while ((read = in .read(buf)) > 0) { out.write(buf, 0, read); } } finally { if ( in != null) { in .close(); } } byte b[] = out.toByteArray(); System.out.println(new String(b, "utf-8")); }
Python调用代码:
import urllib, urllib2, sys host = ‘‘ path = ‘‘ method = ‘GET‘ querys = ‘http%3A%2F%2Fwww.baidu.com‘ bodys = {} url = host + path + ‘?‘ + querys request = urllib2.Request(url) response = urllib2.urlopen(request) content = response.read() if (content): print(content)