Bug #16112 » 16112.patch
| src/etc/inc/dyndns.class | ||
|---|---|---|
|
} else {
|
||
|
$record = "A";
|
||
|
}
|
||
|
$post_data['data'] = $this->_dnsIP;
|
||
|
$server = "https://api.mythic-beasts.com/dns/v2/zones/{$this->_dnsDomain}/records/{$this->_dnsHost}/{$record}";
|
||
|
// Check for existing record
|
||
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
|
||
|
curl_setopt($ch, CURLOPT_URL, $server);
|
||
|
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
|
||
|
$response = json_decode(curl_exec($ch), true);
|
||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||
|
$record_exists = true;
|
||
|
if ($http_code != "200") {
|
||
|
$record_exists = false;
|
||
|
}
|
||
|
$post_data['data'] = $this->_dnsIP;
|
||
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
|
||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||
|
curl_setopt($ch, CURLOPT_URL, $server);
|
||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $record_exists ? "PUT" : "POST");
|
||
|
break;
|
||
|
case 'name.com':
|
||
|
case 'name.com-v6':
|
||