Api detecting micro-channel interfaces domain share and use of the Detailed

Micro-letter domain detection allows us to easily understand the status of all domain names in the promotion of micro letter, real-time detection of a problem in the micro-letter domain name, the domain name can not be opened and reduce the losses caused. So how micro-letter domain detection api interface it? Today to share with a micro-channel detection domain api interface, and explain the use of the method.

 

Api detecting micro Domain Name Interface:

http://www.xiaohejc.cn/check_api.php?url_long=http://www.baidu.com

Instructions for use:

The api interface address in the "http://www.baidu.com" need to be replaced domain detection, and then copied directly go to your browser open.

 

PHP call demo:

$url = 'http://www.baidu.com';
$api_url = 'http://www.xiaohejc.cn/check_api.php?url_long=http://www.baidu.com';
$short_url = file_get_contents($api_url);
echo $short_url;

JAVA call demo:

public static void main(String path[]) throws Exception {
URL u = new URL("http://www.xiaohejc.cn/check_api.php?url_long=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"));
}
 

Python calls the demo:

import urllib, urllib2, sys
host = 'http://www.xiaohejc.cn/'
path = 'check_api.php?url_long='
method = 'GET'
querys = 'url=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)
 

 

Precautions:

① When calling api interface simply "http://www.baidu.com" replaced need to detect domain name or URL.

② interface supports url parameters, when the & symbol appears in the url, use instead of 26%, otherwise the parameters may be lost.

③ Please buy the official version of the interface version of the prompts to open membership contact interface service providers.

Guess you like

Origin www.cnblogs.com/wwecc/p/11989067.html