0

I tried with sending a GET request using ESP8266 wifi module using Arduino.The module successfully responded with :

SEND OK +IPD

On server, I want to receive the data and write it in a text file. So i tried the following codes

>parse_str( html_entity_decode( $_SERVER['QUERY_STRING']) , $out); $data= $out['data'];

$fileStatus=file_put_contents('myFile.txt',$data,FILE_APPEND);
if($fileStatus!=false){
    echo "SUCCESS";
} else{ echo "FAIL"; }

But the data failed to store.

0

1 Answer 1

1

Assuming your GET request from the ESP to the server was made to the URL http://example.com/myPhpScript.php?parameter1=xxxx&parameter2=yyyy

you should be able to get the the value of parameter1 and paramter2 like this:

<?php
$p1 = $_GET['parameter1'];
$p2 = $_GET['parameter2'];

$data = $p1.','.$p2;
file_put_contents('myFile.txt',$data,FILE_APPEND);
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.