Project

General

Profile

« Previous | Next » 

Revision 6c92b378

Added by Christopher Fazendin over 10 years ago

Add Google Domains to Dynamic DNS service.

View differences:

etc/inc/dyndns.class
32 32
	 *    - City Network (citynetwork.se)
33 33
	 *    - GleSYS (glesys.com)
34 34
	 *    - DNSimple (dnsimple.com)
35
	 *    - Google Domains (domains.google.com)
35 36
	 * +----------------------------------------------------+
36 37
	 *  Requirements:
37 38
	 *    - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library
......
76 77
	 *  City Network    - Last Tested: 13 November 2013
77 78
	 *  GleSYS          - Last Tested: 3 February 2015
78 79
	 *  DNSimple        - Last Tested: 09 February 2015
80
	 *  Google Domains  - Last Tested: 27 April 2015
79 81
	 * +====================================================+
80 82
	 *
81 83
	 * @author 	E.Kristensen
......
249 251
					case 'ovh-dynhost':
250 252
					case 'citynetwork':
251 253
					case 'dnsimple':
254
                    case 'googledomains':
252 255
						$this->_update();
253 256
						if ($this->_dnsDummyUpdateDone == true) {
254 257
							// If a dummy update was needed, then sleep a while and do the update again to put the proper address back.
......
740 743
					curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '/records/' . $this->_dnsZoneID);
741 744
					curl_setopt($ch, CURLOPT_POSTFIELDS, $jsondata);
742 745
					break;
746
                case 'googledomains':
747
					$needsIP = FALSE;
748
					if ($this->_dnsVerboseLog) {
749
						log_error("Google Domains: ({$this->_dnsHost}) DNS update() starting.");
750
					}
751
					$post_data['username:password'] = $this->_dnsUser . ':' . $this->_dnsPass;
752
					$post_data['hostname'] = $this->_dnsHost;
753
					$post_data['myip'] = $this->_dnsIP;
754
					$post_data['offline'] = 'no';
755

  
756
                    $server = "https://domains.google.com/nic/update";
757
					$port = "";
758
                    curl_setopt($ch, CURLOPT_SSLVERSION, 6);
759
                    curl_setopt($ch, CURLOPT_USERAGENT, 'Chrome/41.0');
760
					curl_setopt($ch, CURLOPT_URL, 'https://domains.google.com/nic/update');
761
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
762
					curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
763
					break;
743 764
				default:
744 765
					break;
745 766
			}
......
1288 1309
						$this->_debug($body);
1289 1310
					}
1290 1311
					break;
1312
                case 'googledomains':
1313
					if (preg_match('/notfqdn/i', $data)) {
1314
						$status = "phpDynDNS ({$this->_dnsHost}): (Error) Not A FQDN";
1315
					} else if (preg_match('/nochg/i', $data)) {
1316
						$status = "phpDynDNS ({$this->_dnsHost}): (Success) No Change In IP Address";
1317
						$successful_update = true;
1318
					} else if (preg_match('/good/i', $data)) {
1319
						$status = "phpDynDNS ({$this->_dnsHost}): (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
1320
						$successful_update = true;
1321
					} else if (preg_match('/badauth/i', $data)) {
1322
						$status = "phpDynDNS ({$this->_dnsHost}): (Error) User Authorization Failed";
1323
                    } else if (preg_match('/nohost/i', $data)) {
1324
						$status = "phpDynDNS ({$this->_dnsHost}): (Error) Hostname does not exist or DynDNS not enabled";
1325
                    } else if (preg_match('/badagent/i', $data)) {
1326
						$status = "phpDynDNS ({$this->_dnsHost}): (Error) Bad request";
1327
                    } else if (preg_match('/abuse/i', $data)) {
1328
						$status = "phpDynDNS ({$this->_dnsHost}): (Error) Dynamic DNS access has been blocked!";
1329
                    } else if (preg_match('/911/i', $data)) {
1330
						$status = "phpDynDNS ({$this->_dnsHost}): (Error) Error on Google's end, retry in 5 minutes";
1331
					} else {
1332
						$status = "phpDynDNS ({$this->_dnsHost}): (Unknown Response)";
1333
						log_error("phpDynDNS ({$this->_dnsHost}): PAYLOAD: {$data}");
1334
						$this->_debug($data);
1335
					}
1336
					break;
1291 1337
			}
1292 1338

  
1293 1339
			if ($successful_update == true) {

Also available in: Unified diff