Skip to content

Instantly share code, notes, and snippets.

@rmehner
Created August 25, 2013 16:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmehner/6334708 to your computer and use it in GitHub Desktop.
Save rmehner/6334708 to your computer and use it in GitHub Desktop.
<?php
#### configuration ####
$email = 'YOUR_EMAIL_ADDRESS';
$token = 'YOUR_API_TOKEN';
$hostName = 'all'; // use 'all' if you want to update all hosts
#### cURL request below ####
$json_data = json_encode(array(
'ip_address' => 'auto'
));
$curl = curl_init("https://api.twodns.de/hosts/${hostName}");
curl_setopt_array(
$curl,
array(
CURLOPT_USERPWD => "${email}:${token}",
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => $json_data
)
);
curl_exec($curl);
curl_close($curl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment