In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
 
            
                     
                
2025-10-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use Sina short links / Tencent short links API interface", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use Sina short links / Tencent short links API interface" this article.
Interface address
Short URL interface address:
1. Interface address: http://www.wx-url.cn/sina.php?url_long=http://www.baidu.com
two。 Interface address: http://dogdwz.cn/tcnjson?url=http://www.baidu.com
3. Interface address: http://www.sina-url.cn/xinlang?url=http://www.baidu.com
4. Interface address: http://www.wx-dwz.cn/tcnurl?url=https://www.baidu.com
5. Interface address: http://mhdwz.cn/mhsina?url=http://www.baidu.com
6. Interface address: http://maiyurl.cn/weibourl?url=http://www.baidu.com
Note: replace the link in the red part of the api interface of the above short URL with a long connection that needs to be shortened!
Interface document
PHP call code:
$url = 'http://www.baidu.com';$api_url =' .urlencode ($url); $short_url = file_get_contents ($api_url); echo $short_url
Other language call documents
JAVA call code:
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 call code:
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) Note:
1. When using the api API, you only need to replace the link after URL= with the long link that needs to be shortened on your own side.
2. The API supports parameter passing. When the & symbol appears in the link, use% 26 instead (or use url coding), otherwise the parameters will be lost.
3. When filling in the link, you must use the http (s): / / protocol, otherwise the API interface will not be able to generate short links!
The above is all the content of this article "how to call Sina short link / Tencent short link API interface". 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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about

The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r


A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from

Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





 
             
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.