-
-
Save depwl9992/bf892f1e3cc0694fc92edae1587ff75f to your computer and use it in GitHub Desktop.
ENOM IP Updater (PHP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Fork from Agarzon's original version using beefed up cURL script and function calls */ | |
function runEnom($zone, $pass) { | |
$sh = curl_init(); | |
$url = "http://dynamic.name-services.com/interface.asp"; | |
$get = array( | |
"Command"=>"SetDNSHost", | |
"Zone"=>$zone, | |
"DomainPassword"=>$pass | |
); | |
$defaults = array( | |
CURLOPT_URL=>$url . (strpos($url,'?') === FALSE ? '?' : '') . http_build_query($get), | |
CURLOPT_HEADER=>0, | |
CURLOPT_RETURNTRANSFER=>TRUE, | |
CURLOPT_TIMEOUT=>4 | |
); | |
curl_setopt_array($sh,$defaults); | |
if (!$result = curl_exec($sh)) { | |
trigger_error(curl_error($sh)); | |
} | |
curl_close($sh); | |
return $result; | |
} | |
/* Run this script every 5 minutes (or 1 hour, is up to you) using a cron task */ | |
$passwd = "domainPassword"; | |
runEnom("@.domain.com", $passwd); | |
runEnom("www.domain.com", $passwd); | |
runEnom("sub.domain.com", $passwd); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment