{ #www.routeros.cn 20190921 #v>6.43 :local rr :global dname "test7" :global domain "test" :local dkey "xxxxxxxxxxxxxxxx" :local result :local resulta :local ipip "1.1.1.2" :global ddname ($dname.".".$domain) :local testa :local testb :local testi :local sip :do { :set sip [:resolve $ddname] } on-error={ :set sip "1.1.1.1" }; :if ($ipip!=$sip) do={ :do { :set result [/tool fetch url="https://www.namesilo.com/api/dnsListRecords?version=1&type=xml&key=$dkey&domain=$domain" mode=https as-value output=user] } on-error={ }; :delay 1 #>6.43 :if ($result->"status" = "finished") do={ :set rr ($result->"data") :set testi [:find $rr ("".$ddname)] :if ($testi > 100) do={ :set rr [:pick $rr 0 ($testi-26)] :set testa [:pick $rr ([:len $rr]-32) [:len $rr]] :do { :set resulta [/tool fetch url="https://www.namesilo.com/api/dnsUpdateRecord?version=1&type=xml&key=$dkey&domain=$domain&rrid=$testa&rrhost=$dname&rrvalue=$ipip&rrttl=3600" mode=https as-value output=user] } on-error={ }; } else={ :do { :set resulta [/tool fetch url="https://www.namesilo.com/api/dnsAddRecord?version=1&type=xml&key=$dkey&domain=$domain&rrtype=A&rrhost=$dname&rrvalue=$ipip&rrttl=3600" mode=https as-value output=user] } on-error={ }; } :if ($resulta->"status" = "finished") do={ :set rr ($resulta->"data") :set testa [:find $rr ""] :set testb [:find $rr ""] :set rr [:pick $rr ($testa+8) $testb] :if ($rr != "success") do={ :log error ("RouterOS.cn v20220830 Namesilo update domain name [".$ddname."] IP [".$ipip."] Fail:".$rr) } else={ :log warning ("RouterOS.cn v20220830 Namesilo update domain name [".$ddname."] IP [".$ipip."] ".$rr) } } } else={ :log error ("RouterOS.cn v20220830 Namesilo\B8\FC\D0\C2\D3\F2\C3\FB\B3\F5\CA\BC\BB\AF\CA\A7\B0\DC\C7\EB\BC\EC\B2\E9\CD\F8\C2\E7\BB\B7\BE\B3"); } } }