1 <?php
2 /**
3 这个是php版的代码
4 要先准备一台一个站群服务器,建议一整个c段253IP以上的服务器
5 原理是,假墙封ip几个小时,每1分钟换一次解析,轮流使用250多个ip使其超过他封禁时间
6 用linux定时任务,每一分钟运行此一次:如新建网站,保存此文件名为q.php,网站端口4521,宝塔提交定时url任务 : http://127.0.0.1:4521/q.php
7 **/
8
9 $file = './tqdata.txt'; // 同目录下新建tqdata.txt文件,里面填个数字 比如 1,用来记录当前使用的
10 $txt = file_get_contents($file);
11 $ips = [];
12 for($i=1; $i <=254; $i++){
13 $ips[$i] = '45.45.45.' . $i; // 自己的ip
14 }
15
16 $ip = $ips[$txt];
17 // 进cf解析页f12,找到那条记录,提交,得到下面的提交地址 xxxx是需要替换成自己的
18 $www='https://api.cloudflare.com/client/v4/zones/xxxx/dns_records/xxxx';
19
20 $datawww = array(
21 "type"=>"A",
22 "name"=>"www.domain.com",
23 "content"=>$ip,
24 "ttl"=>120,
25 "proxied"=>false
26 );
27
28
29 curl_get($www,$datawww);
30
31 function curl_get($url,$data)
32 {
33 $ch = curl_init();
34 $headers = array(
35 'X-Auth-Email:自己cf的账号',
36 'X-Auth-Key:自己cf的key',
37 'Content-Type:application/json'
38 );
39 $data = json_encode($data);
40 $ch = curl_init(); //初始化CURL句柄
41 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
42 curl_setopt($ch, CURLOPT_URL, $url); //设置请求的URL
43 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //设为TRUE把curl_exec()结果转化为字串,而不是直接输出
44 curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"PUT"); //设置请求方式
45 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);//设置提交的字符串
46 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 信任任何证书
47 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 检查证书中是否设置域名
48 $output = curl_exec($ch);
49 curl_close($ch);
50 return json_decode($output,true);
51 }