Svane Posted June 16, 2015 Share Posted June 16, 2015 Hi everyone Im newbie, so sorry for what I think is a total basic question. But I really cant get the value out of my POST request. I POST the data from my Arduino, and try to catch it in PHP. Below I have the PHP code: If i set $current .= $social; No value is printet in my txt file. If I set $current .= $roughHTTPPOST; This value is put into the txt file: social=1111111111&temp1=22&hum1=46 So it seems like I dont get value in here: $social = $_POST['social']; Can someone help me? <?php $social = $_POST['social']; $temp1 = $_POST['temp1']; $hum1 = $_POST['hum1']; $file = 'test.txt'; // Open the file to get existing content $current = file_get_contents($file); $roughHTTPPOST = @file_get_contents('php://input'); $current .= $social; // Write the contents back to the file file_put_contents($file, $current); ?> Link to comment https://forums.phpfreaks.com/topic/296844-problems-with-post-request/ Share on other sites More sharing options...
Muddy_Funster Posted June 16, 2015 Share Posted June 16, 2015 var_dump ($_POST) and see what's actually in you post data (and show us too) Link to comment https://forums.phpfreaks.com/topic/296844-problems-with-post-request/#findComment-1514054 Share on other sites More sharing options...
Barand Posted June 16, 2015 Share Posted June 16, 2015 Is this what you are trying to do? $data = array(); $roughHTTPPOST = @file_get_contents('php://input'); parse_str($roughHTTPPOST , $data); $current .= $data['social']; Link to comment https://forums.phpfreaks.com/topic/296844-problems-with-post-request/#findComment-1514082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.