Skip to content

Instantly share code, notes, and snippets.



Created May 9, 2012
What would you like to do?
Update DNS Made Easy DDNS Record with Local IP
* Update DNS Made Easy DDNS Record with Local IP
* Copyright 2012, Joe Lambert.
* Free to use under the MIT license.
// The record you wish to update
$dns_record = array(
// A label representation of the record
'label' => "*",
// The DNS record's ID - found in the DNS Made easy control panel
'id' => 123456,
// Your DDNS username/password
$username = "username";
$password = "password";
// Work out the local IP Address
exec('ifconfig en1', $response);
$response = implode("\n", $response);
preg_match("/inet ([0-9\.]+)/", $response, $matches);
$new_ip = $matches[1];
// Make the API Call
echo "Updating {$dns_record['label']} to $new_ip\n";
$response = file_get_contents("{$username}&password={$password}&id={$dns_record['id']}&ip={$new_ip}");
echo trim($response) . "\n";
// Clear the local DNS cache
exec('dscacheutil -flushcache');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment