> For the complete documentation index, see [llms.txt](https://wechaturl.gitbook.io/wechaturl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wechaturl.gitbook.io/wechaturl/shorturl/long2shorturl.md).

# 4.2 长网址转短网址

能将你的长网址转成多种短网址:

**请求URL：**

* `https://wechaturl.us/api/Long2ShortUrl.json?appid=37****15&appkey=a50d38748960******80ae1a725b7c95&entry_type=wechaturl&url=http://www.baidu.com`

**请求方式：**

* POST 或者GET(如果用GET,特殊字符串需要url编码)

SDK

* PHP: <https://github.com/wechaturl/wechat_url_api/blob/master/Long2ShortUrl_example.php>
* JAVA:<https://github.com/wechaturl/wechat_url_api_java_sdk/blob/master/src/main/java/www/wechaturl/us/fangfeng/sdk/service/ShortUrlService.java>

**参数：**

| 参数名         | 必选 | 类型     | 说明                                                                                                                                                                                          |
| ----------- | -- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| appid       | 是  | int    | <http://www.wechaturl.us/user/index.html> 去免费获取appid                                                                                                                                        |
| appkey      | 是  | string | <http://www.wechaturl.us/user/index.html> 去免费获取appkey                                                                                                                                       |
| entry\_type | 是  | string | 默认wechaturl;目前支持\['wechaturl','sohuurl','ueeurl','weibourl','tencent\_weibourl','is\_gd\_url','maa\_la','soso\_bz'];这些类型可以到<https://wechaturl.gitbook.io/wechaturl/the-third-shorturl> 查看解释 |
| url         | 是  | string | 输入http(s)://开头的网址                                                                                                                                                                           |

**返回示例**

```
{
  "code": 1,
  "message": "ok;目前支持[wechaturl,sohuurl,ueeurl,weibourl,tencent_weibourl,is_gd_url]，默认情况会使用wechaturl；详细请到https://wechaturl.gitbook.io/wechaturl/the-third-shorturl了解",
  "data": {
    "entry_type": "wechaturl",
    "code": 1,
    "message": "success",
    "shorturl": "https://w.url.cn/s/ASneng8?_wv=2",#这个就是你想到的短网址
    "longurl": "https://yourdomain.com/anyurl?any_get=any_value#any_front",
    "data": {  #这个节点是第三方返回的原始数据
      "code": 0,
      "short_url": "https://w.url.cn/s/ASneng8"
    }
  }
}
```

> 重要：**由于腾讯升级，导致微信短网址只能在手机设备上打开，建议你切换到其他**

[**查看所有CODE、STATUS值含义**](https://github.com/wanjunlengfeng/WechatUrlCheckPreventingBlockedApi/blob/master/微信防封杀系统api接口详细说明/CODE代码汇总.md)
