$temperature = $_GET['temp']; $humidity = $_GET['humidity']; $data ='{temperature='.$temperature.',humidity='.$humidity.'}'; $myfile = fopen("reieveddata.json", "w") or die("Unable to open file!"); fwrite($myfile, $data); fclose($myfile);