api更新cloudfflare dns (DDNS) api更新cloudfflare dns (DDNS)

api更新cloudfflare dns (DDNS)

#!/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"
分享本文至:

评论 0

挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
提交评论

清空信息
关闭评论