Gude!
Nach langer Inaktivität habe ich mir mal gedacht, dass ich mein Skript, welches via HTTPS-Befehl Zugriff auf die API von Godaddy, die IP eines DNS Eintrags Ändert hier hochlade.
Für das Absenden via HTTPS müsst ihr im Skript-Ordner die Curl.exe platzieren - LINK
Das Skript mag nicht perfekt sein und noch einige Verbesserungs-Möglichkeiten haben, allerdings funktioniert es für mich bereits schon ewig.
Es kann wunderbar als .exe mit der Aufgabenplanung ausgeführt werden - ich lasse das Skript alle 5 Minuten ausführen.
Für Anregungen bin ich immer zu haben!
LG Timo
AutoIt
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=update-compusales.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Inet.au3>
#include <File.au3>
Local $lip
$log = @ScriptDir & "\log.csv"
$auth = "euer API-Key"
$domain = "eure Domäne"
$name = "eure Domäne"
$ttl = "600" ;Sollte auf diesem Mindest-Wert bleiben, niedrigere Werte funktionieren nicht
If FileExists( $log ) <> 1 Then
_FileCreate( $log )
_logwrite("Logfile erstellt")
EndIf
TCPStartup()
$dip = TCPNameToIP($domain)
TCPShutdown()
If @error Then
_logwrite("Could not resolve current dns IP Address")
Else
$cip = _GetIP()
If @error Then
_logwrite("Could not retreive external IP, maybe the WAN Interface was down")
Else
If $cip == $dip Then
;~ _logwrite("No change in IP")
Else
_logwrite("New IP detected: " & $cip)
$curl = 'curl -X PUT "https://api.godaddy.com/v1/domains/' & $domain &'/records/A" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: sso-key ' & $auth & '" -d "[ { \"data\": \"' & $cip & '\", \"name\": \"' & $name & '\", \"priority\": 1, \"ttl\": ' & $ttl & ', \"weight\": 1 }]"'
RunWait($curl, "", @SW_HIDE)
If @error Then
_logwrite("could not start Curl to insert IP to GoDaddy")
EndIf
EndIf
EndIf
EndIf
Func _logwrite($data)
$h = FileOpen( $log , 1 )
FileWrite( $h , @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & ":" & @MIN & ";" & $data & @CRLF )
FileClose( $h )
EndFunc
Alles anzeigen