Damit will ich bein DynDNS bei GoDaddy erreichen … bis auf die aktuell gesetzt IP auszulesen, klappt alles.
Die Sektion die nicht geht steht in „Return current setting“
<?
$key = ""; #key for godaddy developer API
$secret = ""; #Secret for godday developer API
$domain = ".net";
$aname = "..net";
//Current IP
/*
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://ipinfo.io/json');
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$json = curl_exec($ch);
curl_close($ch);
//echo $json;
$data = json_decode($json);
$ip = $data->ip;
echo $ip;
*/
//Return current setting
$url = 'https://api.godaddy.com/v1/domains/'.$domain.'/records/A/'.$aname;
// set your key and secret
$header = array(
'Authorization: sso-key '.$key.':'.$secret
);
//print_r ($header);
//open connection
$ch = curl_init();
$timeout=60;
//set the url and other options for curl
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); // Values: GET, POST, PUT, DELETE, PATCH, UPDATE
//curl_setopt($ch, CURLOPT_POSTFIELDS, $variable);
//curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
//execute call and return response data.
$result = curl_exec($ch);
//close curl connection
curl_close($ch);
// decode the json response
$dn = json_decode($result, true);
//echo '<pre>';
print_r($dn);
//echo '</pre>';
$dnsip = $dn[0]['data'];
print_r($dn);
// Update
/*
$input_json = array("data" => $ip, "ttl"=> 3600);
//print_r ($input_json);
$data_string = json_encode($input_json);
$data_string = "[ ".$data_string." ]";
print_r ($data_string);
//$url = 'https://api.godaddy.com/v1/domains/lueckel.net/records/A/home.lueckel.net';
$url = 'https://api.godaddy.com/v1/domains/'.$domain.'/records/A/'.$aname;
// set your key and secret
$header = array(
'Authorization: sso-key '.$key.':'.$secret,
'Content-Type: application/json',
'Accept: application/json'
);
//print_r ($header);
//open connection
$ch = curl_init();
$timeout=60;
//set the url and other options for curl
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json-patch');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $input_json);
curl_setopt($ch, CURLOPT_POST, true);
//execute call and return response data.
$result = curl_exec($ch);
//close curl connection
curl_close($ch);
// decode the json response
$dn = json_decode($result, true);
echo '<pre>';
print_r($dn);
echo '</pre>';
*/
?>