23.05 - Uncaught Error: Attempt to assign property "domain_records"
-
i'm pretty sure it's still json and it's probably an error
maybe @chrisjx can use postman / insomnia to check what the answer is
maybe, but i'm just putting random stuff here without an account on digitalocean to try
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , "Authorization: Bearer {$this->_dnsPass}"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);https://docs.digitalocean.com/reference/api/api-reference/#operation/domains_list_records
https://docs.digitalocean.com/reference/api/api-reference/#operation/domains_update_record
-
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <my-do-api-key>" "https://api.digitalocean.com/v2/domains/<my-root-domain>/records"
I can confirm that executing the CURL command (as described in the DO API page) returns a fully loaded json set with name, data (ip), etc. It had 10 entries that looked like this:
{ "id": 299240866, "type": "A", "name": "xxxxxx", "data": "xx.xx.xxx.xx", "priority": null, "port": null, "ttl": 300, "weight": null, "flags": null, "tag": null }
Will try to log the values being returned in the code and see what's different.
Apologies for delay... appreciate the effort of those persisting with ideas.
Thank you.
-
This below seems to be working; IOW, not throwing any errors:
Starting at what I think is line 1414. It's kind of messy but I was trying to figure out how to display the return values into the system log file. I'm jut no good at understanding how to stringify objects in PHP. In any case the five minute errors are no longer happening and I'm seeing messages like this every 5 minutes instead of errors:
rc.dyndns.update: phpDynDNS (music): No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.
Working...
case 'digitalocean': case 'digitalocean-v6': // Get record ID $server = 'https://api.digitalocean.com/v2/domains/'; $isv6 = ($this->_dnsService === 'digitalocean-v6'); $url = $server . $this->_dnsDomain . '/records'; curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer {$this->_dnsPass}")); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FORBID_REUSE, true); // original line where error was thrown // $output = json_decode(curl_exec($ch)); $response = curl_exec($ch); // log_error(sprintf(gettext("DO API response: %s"), var_export($response))); $output = json_decode($response); // log_error(sprintf(gettext("DO API output: %s"), var_export($output))); // log_error(sprintf(gettext("DO API output domain records: %s"), var_export($output->domain_records))); if (!is_array($output->domain_records)) { $output->domain_records = array(); }
Thanks,
Chris -
well done,
$response = curl_exec($ch);
$output = json_decode($response);could be it
-