小安发卡 授权 API
欢迎使用 小安发卡 在线授权平台 API。本文档指导您通过外部程序对接域名授权系统。
基础信息
- 接口根路径:
- 请求方式:支持
- 数据格式:统一返回
- 提交授权接口需携带签名,签名密钥为后台「系统设置」中的 API 密钥
- 接口根路径:
https://auth.ethw.cc/api/- 请求方式:支持
GET 和 POST- 数据格式:统一返回
JSON- 提交授权接口需携带签名,签名密钥为后台「系统设置」中的 API 密钥
GET 1. 授权查询接口
通过域名或卡密查询授权状态,无需密钥。
请求地址
https://auth.ethw.cc/api/query.php
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
auth_domain | String | 否 | 要查询的授权域名(与 card_code 二选一) |
card_code | String | 否 | 32 位卡密(与 auth_domain 二选一) |
secret | String | 否 | 查询最近 20 条全局记录(需 API 密钥) |
查询示例
1. 查域名:?auth_domain=example.com
2. 查卡密:?card_code=76DE40B34574622C04D326658F57CBE9
成功返回示例
JSON
{
"code": 200,
"msg": "查询成功",
"data": {
"auth_domain": "example.com",
"card_code": "76DE40B34574622C04D326658F57CBE9",
"duration": "year",
"is_valid": true,
"status_text": "有效",
"expire_at": "2027-11-01 14:00:00",
"created_at": "2026-11-01 14:00:00"
}
}POST 2. 提交授权接口
消耗卡密,为指定域名开通授权。需签名验证。
请求地址
https://auth.ethw.cc/api/auth.php
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
card_code | String | 是 | 32 位卡密 |
card_key | String | 是 | 64 位密钥 |
auth_domain | String | 是 | 授权域名,如 example.com 或 *.example.com |
sign | String | 是 | 签名,见下方算法 |
签名算法
sign = md5(card_code + card_key + auth_domain + api_secret)
3. 对接代码示例
PHP 对接示例
PHP
<?php
function queryAuth($domain) {
$url = 'https://auth.ethw.cc/api/query.php?auth_domain=' . urlencode($domain);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($ch);
curl_close($ch);
return json_decode($res, true);
}
$r = queryAuth('example.com');
if ($r['code'] === 200 && $r['data']['is_valid']) {
echo "授权有效,到期:" . $r['data']['expire_at'];
} else {
echo "授权无效或已过期";
}Python 对接示例
Python
import requests
def query_auth(domain):
url = 'https://auth.ethw.cc/api/query.php'
res = requests.get(url, params={'auth_domain': domain}, timeout=10)
data = res.json()
if data.get('code') == 200 and data['data']['is_valid']:
print(f"授权有效,到期:{data['data']['expire_at']}")
return True
print(f"授权无效:{data.get('msg')}")
return False
query_auth('example.com')