Thought the same. Actually re-created another test file by hand directly on the mac using VIM and still getting the same error.
<?php
define('HHAPI_URL', '192.168.5.1:9399 port/api');
define('HHAPI_USER', 'USER');
define('HHAPI_PASS', 'PASS');
// HHAPI Calls
if (isset($_GET["newTargetValue"])) {
if ($_GET["newTargetValue"] == 1) {
hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').on()');
}
elseif ($_GET["newTargetValue"] == 0) {
hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').off()');
}
}
function hhapi($cmd) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, HHAPI_URL);
curl_setopt($ch, CURLOPT_USERPWD, HHAPI_USER . ':' . HHAPI_PASS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_POST, 1);
curl_Setopt($ch, CURLOPT_POSTFIELDS, $cmd);
$result = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if($error) echo $error;
return json_decode($result);
}
?>
Helper Error:
Unhandled exception in script on line: 0: unitWithNumber() requires a single argument of type Number.
URL:
http://192.168.5.1/hh.php?newTargetValue=1?DeviceNum=002
Going to play with some hard-coded php files to see if it makes a difference.
Thanks