Jump to content

Problems with POST request


Svane

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.