Bug #16112 ยป 16112.patch
| src/etc/inc/dyndns.class | ||
|---|---|---|
| 890 | 890 |
} else {
|
| 891 | 891 |
$record = "A"; |
| 892 | 892 |
} |
| 893 |
$post_data['data'] = $this->_dnsIP; |
|
| 893 | ||
| 894 | 894 |
$server = "https://api.mythic-beasts.com/dns/v2/zones/{$this->_dnsDomain}/records/{$this->_dnsHost}/{$record}";
|
| 895 |
// Check for existing record |
|
| 896 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); |
|
| 897 |
curl_setopt($ch, CURLOPT_URL, $server); |
|
| 898 |
curl_setopt($ch, CURLOPT_FORBID_REUSE, true); |
|
| 899 |
$response = json_decode(curl_exec($ch), true); |
|
| 900 |
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
| 901 |
$record_exists = true; |
|
| 902 |
if ($http_code != "200") {
|
|
| 903 |
$record_exists = false; |
|
| 904 |
} |
|
| 905 | ||
| 906 |
$post_data['data'] = $this->_dnsIP; |
|
| 895 | 907 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); |
| 896 | 908 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
| 897 | 909 |
curl_setopt($ch, CURLOPT_URL, $server); |
| 910 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $record_exists ? "PUT" : "POST"); |
|
| 898 | 911 |
break; |
| 899 | 912 |
case 'name.com': |
| 900 | 913 |
case 'name.com-v6': |