Try this:
$headers = array('Content-Type: application/json'); $data = "{'Aquatemp60': '".$temp."'}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $user.":".$pass); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $out = curl_exec($ch); curl_close($ch);
get this:
SyntaxError: Unexpected token ' at Object.parse (native) at parse (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/lib/types/json.js:88:17) at /home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/lib/read.js:116:18 at invokeCallback (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:262:16) at done (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:251:7) at IncomingMessage.onEnd (/home/pi/pimatic-app/node_modules/pimatic/node_modules/body-parser/node_modules/raw-body/index.js:307:7) at emitNone (events.js:67:13) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:913:12) at nextTickCallbackWith2Args (node.js:442:9) at process._tickDomainCallback (node.js:397:17)
What do i wrong?