短网址生成
其他 官方文档
将网页地址生成短链接,永久有效(打个问号?)
基本说明:
接口地址:https://cn.apihz.cn/api/wangzhan/dwz1.php
返回格式:json
请求方式:get/post
请求示例:https://cn.apihz.cn/api/wangzhan/dwz1.php?id=1&key=key&type=1&url=https://free-api.com/
请求参数说明:
名称 类型 必填 说明
id int 必填 用户中心的数字ID:10004093
key string 必填 对应平台用户中心通讯秘钥,非本平台 扫码关注公众号
url string 必填 要跳转的网页地址,如果地址中带&符号,请将&替换为<>,链接长度最大1000
返回参数说明:
名称 类型 说明
domain string 域名
dwz string 短网址
JSON返回示例:
{
	"code": 200,
	"ucode": "aDRoh",
	"domain": "oo1.xyz",
	"dwz": "https://oo1.xyz/aDRoh"
}
服务级错误码参照
错误码 说明
400 错误信息提示
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2025/4/20 07:11
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://cn.apihz.cn/api/xinwen/baiducj.php?id=10004093&key=1';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://cn.apihz.cn/api/xinwen/baiducj.php?id=10004093&key=1"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}