后面多了一个空格,单引号前 zghwelcome 发表于 2022-8-12 15:03
把两边的中括号去了试试[ ]
你說的這幾個 我都測試過了 就是失敗 代码私我试试 zghwelcome 发表于 2022-8-12 15:29
代码私我试试
可以了 感謝過了將 ContentType改為Content-Type就可以過了
感謝您的幫忙...................... 整理一下回覆如下:
利用AUTOIT 更新 GODADDY DNS 首先要去 GODADDY 申請API才可以續續 後面
相關資訊 請參考 第一頁
簡單的改為AUTOIT 語法如下
$mydomain = "chain123.com"
$myhostname = "video"
$gdapikey = "KEY:密碼"
$url = "https://api.ipify.org"
$httpObj = ObjCreate("winhttp.winhttprequest.5.1")
$httpObj.open("GET", $url)
$httpObj.Send()
$HTMLSource = $httpObj.ResponseBody
ConsoleWrite(BinaryToString($HTMLSource)&@CRLF)
$NEWIP=BinaryToString($HTMLSource)
$url = "https://api.godaddy.com/v1/domains/" & $mydomain & "/records/A/" & $myhostname
$httpObj = ObjCreate("winhttp.winhttprequest.5.1")
$httpObj.open("GET", $url)
$httpObj.setRequestHeader('Authorization', 'sso-key ' & $gdapikey)
$httpObj.Send()
$HTMLSource = $httpObj.ResponseBody
ConsoleWrite(BinaryToString($HTMLSource) & @CRLF)
$OldIP=StringRegExpReplace(BinaryToString($HTMLSource), "[^\d]*(\d+.\d+.\d+.\d+).*", '$1')
ConsoleWrite($OldIP & @CRLF)
IF $NEWIP<>$OldIPThen
$url0='[{"data":"'&$NEWIP&'","name":"video","ttl":600,"type":"A"}]'
$url = "https://api.godaddy.com/v1/domains/" & $mydomain & "/records/A/" & $myhostname
$httpObj = ObjCreate("winhttp.winhttprequest.5.1")
$httpObj.open("PUT", $url)
$httpObj.setRequestHeader('Authorization', 'sso-key ' & $gdapikey)
$httpObj.setRequestHeader('Content-Type', 'application/json' )
;$httpObj.setRequestHeader('ContentType', 'text/xml' )
;$httpObj.setRequestHeader('Body', '[{"data":"211.2.2.2",}]' )
$httpObj.Send( $url0)
$HTMLSource = $httpObj.ResponseBody
ConsoleWrite(BinaryToString($HTMLSource) & @CRLF)
EndIf
页:
1
[2]