"666666-fe8c-11e6-bc64-92361f002671", "temperature" => $temperature, "humidity" => $humidity, "date" => date('Y-m-d H:i:s')); $data_json = json_encode($array); $username = 'test'; $token = 'HTFQO-WCNSR-UDEVJ-EPLYE'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $token); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if($response === false){ echo('Error: ' . curl_error($ch)); } else{ echo('Operation successful'); } curl_close($ch); ?>