dyndns.org update via php/curl?

5.5k views Asked by At

Im attempting to maintain an account at dyndns.org via php/curl. Im using (per RTFM):

 https://$account:[email protected]/nic/update?hostname=$host&myip=$ip

but I get a 'nohost' response if $host is new. If $host is an existing entry it works.

Has anyone used this method of communicating with dyndns? Is the api only used to update existing entries?

4

There are 4 answers

1
Chris Gonyea On BEST ANSWER

You can only send IP address updates to existing DynDNS hostnames with the DynDNS API, you cannot create new hostnames.

If you need a full API for creating/deleting/changing hostnames, Dynect SMB may interest you: http://www.dyndns.com/services/dynectsmb/

0
alkarana On

Here is how it works dyndns with php and curl

$server_url = "test.dyndns.biz";
$current_ip ="1.2.3.4";
$url = "https://members.dyndns.org/nic/update?system=dyndns&hostname=".$server_url."&myip=".$current_ip;
                                                              
$username="xxxxxxx";
$password="xxxxxxx";
$base64 = base64_encode("$username:$password");
$authorization = "Authorization: Basic $base64";
$userAgent = "User-Agent: Update Client/v1.0"; 
$headers = array($authorization, $userAgent);     
                                                  
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
$response = curl_exec($ch);
echo $response;
0
TusharJ On

As Oracle have started charging for DynDNS it means the mac client no longer works on 10.15 and higher. I wrote a simple shell script to do this

#!/bin/shell
IP=$(curl "checkip.amazonaws.com")
echo $IP
curl "https://username:[email protected]/v3/update?hostname=biscuit.home.dyndns.org&myip=${IP}" 

Replace the username and updater password in the above.

Works on Mac OS X and Linux

0
dirkk0 On

Since this question was asked three years ago, I can confirm that this still works (in terms of: it just updates an existing hostname) with

curl "https://test:[email protected]/nic/update?hostname=test.dyndns.org&myip=1.2.3.4"