接口地址: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 | 短网址 |
{
"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))
}