接口地址:https://api.uouin.com/app/cloudflare
返回格式:Json
请求方式:Http(s) Get/Post请求
请求示例:https://api.uouin.com/app/cloudflare?username=用户名&key=密钥
接口说明:CloudFlare为全球知名的CDN服务商,免费提供不限流量的CC防护、DDOS防护、CDN加速,但许多节点IP国内访问不佳,甚至无法打开。CloudFlare优选IP通过在全国部署节点测试CloudFlare的公布的IP地址,从而优选国内访问质量较好的IP地址,并可通过官方的SAAS方式A记录接入或购买官方收费版本即可自定义接入,优选IP每10分钟自动更新一次。
请求参数说明:
参数名称 | 必填 | 类型 | 说明 |
---|---|---|---|
username | 是 | string | 用户名 |
key | 是 | string | 密钥 |
nodeid | 否 | string | 默认为ctcc的电信CloudFlare优选IPV4 ctcc为电信CloudFlare优选IPV4 cmcc为移动CloudFlare优选IPV4 cucc为联通CloudFlare优选IPV4 ipv6为国内CloudFlare优选IPV6 bgp为多线CloudFlare优选IPV4 支持自选优选的类型,标签之间用|间隔,例如ctcc|cmcc|cucc则获取电信、移动、联通的优选IP,上限为3个。 |
url | 是 | string | 需要传入的数据或地址 |
返回参数说明:
参数名称 | 类型 | 说明 |
---|---|---|
code | number | 200获取成功 201获取失败 |
data | string | 返回的数据,如有则返回! |
statu | string | 异常为false,正常为true! |
count | number | 点数包,如按量计费则返回! | url | string | 传入的数据! |
响应文本:
{
"msg": "获取成功",
"data": {
"ctcc": {
"code": 200,
"info": [
{
"ip": "172.64.160.3",
"loss": "0.00%",
"ping": "133.61ms",
"speed": "4.11mb/s",
"bandwidth": "32.88mb"
},
{
"ip": "172.64.202.89",
"loss": "0.00%",
"ping": "135.78ms",
"speed": "3.96mb/s",
"bandwidth": "31.68mb"
},
{
"ip": "172.64.139.218",
"loss": "0.00%",
"ping": "136.40ms",
"speed": "3.17mb/s",
"bandwidth": "25.36mb"
},
{
"ip": "172.64.194.242",
"loss": "0.00%",
"ping": "135.74ms",
"speed": "3.16mb/s",
"bandwidth": "25.28mb"
},
{
"ip": "172.64.96.52",
"loss": "0.00%",
"ping": "135.89ms",
"speed": "3.13mb/s",
"bandwidth": "25.04mb"
},
{
"ip": "172.64.105.188",
"loss": "0.00%",
"ping": "136.16ms",
"speed": "3.01mb/s",
"bandwidth": "24.08mb"
},
{
"ip": "172.64.192.178",
"loss": "0.00%",
"ping": "134.98ms",
"speed": "2.77mb/s",
"bandwidth": "22.16mb"
},
{
"ip": "172.64.103.110",
"loss": "0.00%",
"ping": "137.16ms",
"speed": "2.68mb/s",
"bandwidth": "21.44mb"
},
{
"ip": "172.64.140.125",
"loss": "0.00%",
"ping": "136.78ms",
"speed": "1.94mb/s",
"bandwidth": "15.52mb"
},
{
"ip": "172.64.85.239",
"loss": "0.00%",
"ping": "136.70ms",
"speed": "1.55mb/s",
"bandwidth": "12.4mb"
}
],
"uptime": 1712592712
}
},
"statu": "true",
"code": "200"
}
系统状态码参考:
状态码code | 说明 | |
---|---|---|
-200 | 用户名不能空 | |
-201 | key不能空 | |
-202 | url不能为空 | |
-203 | 点数包余额不足 | |
-204 | 访问API频率超过套餐限制,请升级套餐 | |
-205 | 请求的接口地址有误,请到API文档获取请求地址 | |
-206 | 账户VIP会员没开通或已过期 | |
-207 | 用户名或key不对 | |
-208 | 非白名单IP,请添加白名单IP | |
-209 | 账户状态异常 | |
-210 | 接口异常,查询失败 | |
-211 | 账户未绑定手机号 | |
-212 | 检测超时,请重试 | |
-213 | 网址存在安全风险,如误报可添加白名单域名 | |
-214 | API功能未开通 | |
1001 | 检测域名状态正常 | |
1002 | 检测域名状态异常或封禁 | |
200 | 获取数据成功 | |
1 | 短网址类调用生成成功 |
对接代码演示:
$result = file_get_contents("https://api.uouin.com/app/cloudflare?username=用户名&key=密钥&url=".urlencode($url));
$json = json_decode($result,true);
if($json[code] < 0){
echo $json[msg];// API接口异常,返回异常信息
}
if($code == 1001){
echo "域名正常"; //判断code为1001即为正常
}
if($code == 1002){ //判断code为1002即为拦截
echo "已被封禁";
}
//可通过sleep()或usleep()函数控制调用频率