In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to call API, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
To share with you a Wechat domain name blocking detection api, usually use Wechat to open the URLs of some companies, only to find that access has been stopped. For such a situation, it really had a great impact on our company. At that time, we thought of various ways, and then found the following Wechat domain name detection api, built using Wechat's official interface to detect whether Wechat domain name was blocked in real time, which is quite good.
Api API test address:
Http://www.maoapi.cn/wxymjc?url_long=http://www.baidu.com
Application for API Interface Key
①, enter http://www.maoapi.cn/, and select the menu in the upper right corner to register-> fill in the account password.
②, click to register immediately, after the registration is successful, move the mouse to the upper right corner of your account, click on the personal center!
③, enter the personal center, we can see our own Key! (please save your Key)
API interface description
Please save the Key assigned by the system. When calling the API Key, it represents the unique identity of the application. Test, then directly replace the link behind the url= with the long link you need to convert, and you can use it!
Note:
When ① calls the api API, you only need to enter the long URL that needs to be compressed after the URL=.
The ② interface supports the url parameter. When the & symbol appears in the url, use% 26 instead (or use the url encoding format), otherwise the parameter may be lost.
③ must start with http (s): / / when filling in url, otherwise it may cause the test to fail.
Calling code
Demo of PHP call:
$url = 'http://www.baidu.com';$api_url =' http://www.sinadwz.cn/sina.php?url_long=http://www.baidu.com;$short_url = file_get_contents ($api_url); echo $short_url
Demo of JAVA call:
Public static void main (String path []) throws Exception {URL u = new URL ("http://www.sinadwz.cn/sina.php?url_long=http://www.baidu.com");InputStream in = u.openStream (); ByteArrayOutputStream out = new ByteArrayOutputStream (); try {byte buf [] = new byte [1024]; int read = 0X 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"));}
Demo of Python call:
Import urllib, urllib2, syshost = 'http://www.wx-dwz.cn'path =' sina.php?url_long='method = 'GET'querys =' url=http%3A%2F%2Fwww.baidu.com'bodys = {} url= host + path +'?'+ querysrequest = urllib2.Request (url) response = urllib2.urlopen (request) content = response.read () if (content): print (content) above is all the content of the article "how to call API". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.