首页
留言板
关于本站
Search
1
实现网站页面秒开-预加载JS脚本instant.page
56,553 阅读
2
解决Windows连接PPTP/L2TP时无法连接上外网Internet的困扰
55,633 阅读
3
Typecho通过阿里邮件推送和LoveKKComment插件实现评论邮件通知
39,416 阅读
4
如何做到网页性能的极致优化?
29,687 阅读
5
回村无网络之-《无线网桥使用记》
29,590 阅读
路由交换
华为笔记
华三笔记
Mikrotik笔记
中兴笔记
Linux
Nginx
数据库
typecho
WordPress
资源分享
网站技术
Windows
other
未分类
登录
Search
标签搜索
路由交换
运维
linux
ROS
mikrotik
华为
软路由
WordPress
ospf
路由
网站
centos
php
ARP
交换
nssa
typecho
广播风暴
Nginx
dns
Ledo
累计撰写
61
篇文章
累计收到
1,024
条评论
首页
栏目
路由交换
华为笔记
华三笔记
Mikrotik笔记
中兴笔记
Linux
Nginx
数据库
typecho
WordPress
资源分享
网站技术
Windows
other
未分类
页面
留言板
关于本站
搜索到
1
篇与
的结果
2018-11-02
RouteOS下使用dnspod的ddns
强制赋值变量为:code,token,domain_id,record_id 可选变量为:sub_domain,record_type,record_line,value 当变量sub_domain为空时,PHP自动赋值为:『routeos』 当变量record_type为空时,php自动赋值为:『A』 当变量record_line为空时,PHP自动赋值为:『默认』 当变量value为空时,php自动获取当前请求的IP为其值 PHP$realip = getIP(); $code = $_GET['code']; $token = $_GET['token']; $domain_id = $_GET['domain_id']; $record_id = $_GET['record_id']; $sub_domain = $_GET['sub_domain']; $value = $_GET['value']; $record_type = $_GET['record_type']; $record_line = $_GET['record_line']; if (empty($code)) { exit('code empty.'); } if (empty($token)) { exit('token empty.'); } if (empty($domain_id)) { exit('domain_id empty.'); } if (empty($record_id)) { exit('record_id empty.'); } if (empty($sub_domain)) { $sub_domain = "routeos"; } if (empty($record_type)) { $record_type = "A"; } if (empty($record_line)) { $record_line = "默认"; } if (empty($value)) { $value = $realip; } $ip = checkIP($code, $token, $domain_id, $record_id); if (empty($ip)) { exit('ip empty.'); } if ($ip == $value) { exit("IP一致."); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://dnsapi.cn/Record.Modify"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, "login_token=" . $code . "," . $token . "&format=json&domain_id=" . $domain_id . "&record_id=" . $record_id . "&sub_domain=" . $sub_domain . "&value=" . $value . "&record_type=" . $record_type . "&record_line=" . "$record_line"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_close($ch); exit('ok'); function checkIP($code, $token, $domain_id, $record_id ) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://dnsapi.cn/Record.Info"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, "login_token=" . $code . "," . $token . "&format=json&domain_id=" . $domain_id . "&record_id=" . $record_id . ""); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_close($ch); $json = json_decode($server_output, TRUE); return $json['record']['value']; } function getIP(){ if (@$_SERVER["HTTP_X_FORWARDED_FOR"]) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if (@$_SERVER["HTTP_CLIENT_IP"]) $ip = $_SERVER["HTTP_CLIENT_IP"]; else if (@$_SERVER["REMOTE_ADDR"]) $ip = $_SERVER["REMOTE_ADDR"]; else if (@getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (@getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if (@getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "Unknown"; return $ip; } RouteOS 6.x:global id "200000" :global token "*****************25712a6430c5f2" :global domainid "830000" :global recordid "295000000" :global subdomain "routeos" :global xx "https://www.dwhd.org/dnspod_2.php?code=$id&token=$token&domain_id=$domainid&record_id=$recordid" /tool fetch url=("$xx") mode=https keep-result=yes dst-path=ddns.txt RouteOS 5.x:global id "200000" :global token "*****************25712a6430c5f2" :global domainid "830000" :global recordid "295000000" :global subdomain "routeos" :global xx "http://www.dwhd.org/dnspod_2.php?code=$id&token=$token&domain_id=$domainid&record_id=$recordid" /tool fetch url=("$xx") mode=http keep-result=yes dst-path=ddns.txt
2018年11月02日
8,167 阅读
3 评论
0 点赞