Been trying to get a PHP script of mine to load the domoticz API page using CURL to store some data. Going absolutely crazy after reading 4 different ways to do it, implementing each, but not a single one works.
One version of code. This computer resides on the same network as the domotics server. I have authentication disabled for all 192.168.1.* ips.
Code: Select all
$endpoint = 'http://192.168.1.5:3003/json.htm';
$params = array('type' => 'command', 'param' => 'udevice', 'idx' => '30', 'svalue' => $currentwatts);
$url = $endpoint . '?' . http_build_query($params);
curl_setopt($ch, URLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
If i issue echo commands to see what URL is being generated, it's 100% right. If I open the URL via a browser, it works. If I try using wget via Shell for the same it doesn't, presumably because I need escape characters / URL encoding.
Any ideas?
Thanks!