api更新cloudfflare dns (DDNS)
首页 > >    作者:lininn   2020年10月13日 10:35 星期二   热度:1434°   百度已收录  
时间:2020-10-13 10:35   热度:1434° 
#!/bin/bash

zone_name="55555566.xyz" 根域名
record_name='h.55555566.xyz' 要更新的域名
record_type='A'  解析类型
auth_email='liniaa@163.com'   邮箱
auth_key='token' token
ip='127.0.0.1'  要变更为的ip

zone_identifier=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones?name=$zone_name" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key:$auth_key" -H "Content-Type: application/json" | grep -Po '(?<="id":")[^"]*' | head -1 );
echo "$zone_identifier";
record_identifier=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records?name=$record_name&type=$record_type" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json"  | grep -Po '(?<="id":")[^"]*')
echo "$record_identifier";
update=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record_identifier" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" --data "{\"id\":\"$zone_identifier\",\"type\":\"$record_type\",\"name\":\"$record_name\",\"content\":\"$ip\"}")
echo "$update"
二维码加载中...
本文作者:lininn      文章标题: api更新cloudfflare dns (DDNS)
本文地址:?post=481
版权声明:若无注明,本文皆为“覆手为雨”原创,转载请保留文章出处。
分享本文至:

返回顶部    首页    手机版本    后花园   会员注册   
版权所有:覆手为雨    站长: lininn