簡要描述:
微信短網址url.cn鏈接生成
微信短網址的應用場景很廣,譬如短信營銷、郵件推廣、微信營銷、QQ營銷、自媒體推廣、渠道推廣等,都會用到短網址。究其原因是在于短網址可以降低推廣成本、...
請求URL:
http://maiyurl.cn/tengxurl?url_long=http://www.baidu.com
http://www.sinadwz.cn/urlcn/api?url_long=http://www.baidu.com
http://www.qqdwz.cn/urlcn/api?url_long=http://www.baidu.com
請求方式:
GET
參數:
|
參數名 |
必選 |
類型 |
說明 |
|---|---|---|---|
|
url |
是 |
string |
需要縮短的鏈接 |
請求示例
http://maiyurl.cn/tengxurl?url_long=http://www.baidu.com
返回示例
{"short_url": "https://url.cn/54R8NCd","long_url": "https://www.baidu.com/s?ie=UTF-8&wd=api"}
返回參數說明
|
參數名 |
類型 |
說明 |
|---|---|---|
|
short_url |
string |
縮短后的鏈接 |
|
long_url |
string |
原長鏈接 |
1、PHP請求示例:
$url = 'http://www.baidu.com'; $api_url = ' http://maiyurl.cn/weixin/short?link=http://www.baidu.com; $short_url = file_get_contents($api_url); echo $short_url;
2、Java請求示例:
public static void main(String path[]) throws Exception {
URL u = new URL(" http://maiyurl.cn/weixin/short?link=http://www.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"));
}
3、Python請求示例:
import urllib, urllib2, sys
host = ' http://maiyurl.cn'
path = '/weixin/short'
method = 'GET'
querys = 'link=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)
備注
更多接口請訪問API接口官網
http://maiyurl.cn
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。