Skip to content

Instantly share code, notes, and snippets.

@depwl9992
Forked from agarzon/ip-update.php
Last active February 25, 2017 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save depwl9992/bf892f1e3cc0694fc92edae1587ff75f to your computer and use it in GitHub Desktop.
Save depwl9992/bf892f1e3cc0694fc92edae1587ff75f to your computer and use it in GitHub Desktop.
ENOM IP Updater (PHP)
<?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