Google Domains Dynamic DNS responses are not parsed properly
When using Google Domains with the Dynamic DNS feature, it fails for Unknown Response. This is due to Google requiring POST requests to be of type Content-Type: application/x-www-form-urlencoded, and can be fixed by using URL encoded post parametrs.
/services_dyndns_edit.php: phpDynDNS (<domain>): (Unknown Response)
Here is code to fix it in /etc/inc/dyndns.class:
case 'googledomains': $needsIP = FALSE; $post_data['username:password'] = $this->_dnsUser . ':' . $this->_dnsPass; $post_data['hostname'] = $this->_dnsHost; $post_data['myip'] = $this->_dnsIP; $post_data['offline'] = 'no'; $server = "https://domains.google.com/nic/update"; $port = ""; curl_setopt($ch, CURLOPT_URL, 'https://domains.google.com/nic/update'); curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data)); curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent); curl_setopt($ch, CURLOPT_POST,1); break;
To get around the issue, the main thing is changing the CURLOPT_POSTFIELDS value to be http_build_query($post_data) instead of just the $post_data Array. Doing this will force PHP's curl lib to use Content-Type: application/x-www-form-urlencoded... this fixes the issue with P3P and post requests. I threw in the USERAGENT also, since Google says we should use it.
Updated by Viktor Gurov 4 months ago
- Assignee set to Viktor Gurov