SIM800L HTTP POST
Hi Rui & Sara
this example of yours is extracted from the SIM800L tutorial to send data using URL encoded type in the HTTP POST.
$api_key_value = "tPmAT5Ab3j7F9"; $api_key= $sensor = $location = $value1 = $value2 = $value3 = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $api_key = test_input($_POST["api_key"]); if($api_key == $api_key_value) { $sensor = test_input($_POST["sensor"]); $location = test_input($_POST["location"]); $value1 = test_input($_POST["value1"]); $value2 = test_input($_POST["value2"]); $value3 = test_input($_POST["value3"]);
My Question: How to send in TEXT format in ESP32 and receive in PHP at the server
Hi, what do you mean send in TEXT format? I’m not sure if I understand what you are looking for…
- Basically you can modify the SQL table with a new row with TEXT type content
- Then in your Arduino code, you would send a string variable to that newly created database field
- Finally, you need to receive in a similar variable the POST $_POST[“value1”] parameter that you are sending to from your Arduino board
Regards,
Rui
Sorry about that.
Actually, what I was looking for is to send text file with the SIM800L to the webserver, since my data is 100 rows per transaction. I managed to use your tutorial to send 1 row at a time, takes about 1.5sec per row.
I wish I could send the text file in one shot.
Got it, now I know what you mean.
Unfortunately I don’t have any tutorials on that subject, but you would need to create a POST request that would send your .txt file:
https://stackoverflow.com/questions/68115055/how-to-post-multipart-form-data-file-and-text-from-esp32-to-a-server
That link should help