Revision 745d3779
Added by Wagner Sartori Junior almost 8 years ago
src/etc/inc/dyndns.class | ||
---|---|---|
62 | 62 |
* - DuiaDNS IPv6 (www.duiadns.net) |
63 | 63 |
* - Hover (www.hover.com) |
64 | 64 |
* - DreamHost DNS (www.dreamhost.com) |
65 |
* - ClouDNS (www.cloudns.net) |
|
65 | 66 |
* +----------------------------------------------------+ |
66 | 67 |
* Requirements: |
67 | 68 |
* - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library |
... | ... | |
118 | 119 |
* Hover - Last Tested: 15 February 2017 |
119 | 120 |
* DreamHost - Last Tested: 30 April 2017 |
120 | 121 |
* DreamHost IPv6 - Not Yet Tested |
122 |
* ClouDNS - Last Tested: 22 August 2017 |
|
121 | 123 |
* +====================================================+ |
122 | 124 |
* |
123 | 125 |
* @author E.Kristensen |
... | ... | |
226 | 228 |
if (!$dnsZoneID) $this->_error(8); |
227 | 229 |
if (!$dnsTTL) $this->_error(9); |
228 | 230 |
break; |
231 |
case 'cloudns': |
|
232 |
if (!$dnsUser) $this->_error(3); |
|
233 |
if (!$dnsPass) $this->_error(4); |
|
234 |
if (!$dnsHost) $this->_error(5); |
|
235 |
if (!$dnsDomain) $this->_error(5); |
|
236 |
if (!$dnsTTL) $this->_error(9); |
|
237 |
break; |
|
229 | 238 |
case 'custom': |
230 | 239 |
if (!$dnsUpdateURL) $this->_error(7); |
231 | 240 |
break; |
... | ... | |
327 | 336 |
case 'spdyn': |
328 | 337 |
case 'spdyn-v6': |
329 | 338 |
case 'all-inkl': |
339 |
case 'cloudns': |
|
330 | 340 |
case 'hover': |
331 | 341 |
$this->_update(); |
332 | 342 |
if ($this->_dnsDummyUpdateDone == true) { |
... | ... | |
909 | 919 |
curl_setopt($ch, CURLOPT_URL, $server . $port); |
910 | 920 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
911 | 921 |
break; |
922 |
case 'cloudns': |
|
923 |
/* Uses ClouDNS REST API |
|
924 |
Requires auth-id or sub-auth-id or sub-auth-user */ |
|
925 |
// Step 1: Find the Record ID |
|
926 |
$url = 'https://api.cloudns.net/dns/records.json'; |
|
927 |
$post_data['auth-id'] = $this->_dnsUser; |
|
928 |
$post_data['auth-password'] = $this->_dnsPass; |
|
929 |
$post_data['domain-name'] = $this->_dnsDomain; |
|
930 |
$post_data['host'] = $this->_dnsHost; |
|
931 |
$post_data['type'] = 'a'; |
|
932 |
curl_setopt($ch, CURLOPT_URL, $url); |
|
933 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
|
934 |
$output = json_decode(curl_exec($ch)); |
|
935 |
$recordID = key(get_object_vars($output)); |
|
936 |
|
|
937 |
// Step 2: Set the record |
|
938 |
$needsIP = TRUE; |
|
939 |
$url = 'https://api.cloudns.net/dns/mod-record.json'; |
|
940 |
$post_data = array(); |
|
941 |
$post_data['auth-id'] = $this->_dnsUser; |
|
942 |
$post_data['auth-password'] = $this->_dnsPass; |
|
943 |
$post_data['domain-name'] = $this->_dnsDomain; |
|
944 |
$post_data['record-id'] = $recordID; |
|
945 |
$post_data['host'] = $this->_dnsHost; |
|
946 |
$post_data['record'] = $this->_dnsIP; |
|
947 |
$post_data['ttl'] = $this->_dnsTTL; |
|
948 |
curl_setopt($ch, CURLOPT_URL, $url); |
|
949 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
|
950 |
break; |
|
951 |
|
|
912 | 952 |
default: |
913 | 953 |
break; |
914 | 954 |
} |
... | ... | |
1768 | 1808 |
$this->_debug($data); |
1769 | 1809 |
} |
1770 | 1810 |
break; |
1811 |
case 'cloudns': |
|
1812 |
$result = json_decode($data, true); |
|
1813 |
if ($result['status'] == 'Success') { |
|
1814 |
$successful_update = true; |
|
1815 |
} else { |
|
1816 |
log_error($result['status'] . "(" . $result['statusDescription'] . ")"); |
|
1817 |
} |
|
1818 |
break; |
|
1771 | 1819 |
case 'dreamhost': |
1772 | 1820 |
case 'dreamhost-v6': |
1773 | 1821 |
$result = json_decode($data,true); |
Also available in: Unified diff
dyndns: Adding support for ClouDNS (https://www.cloudns.net)