Code: Select all
if (https.begin(*client, connectionString)) {
https.addHeader("Content-Type", "multipart/form-data");
Serial.println(https.POST("query1=12345&query2=134684&query3=1")
wrote a stupid PHP file to mimic the issue I'm having
Code: Select all
<?php
if (empty($_POST)) echo "empty!";
foreach ($_POST as $key => $value) {
echo $key;
echo $value;
}?>
here is the full code.
Is it a bug ? what am I missing here ?
Code: Select all
#include <Arduino.h>
const char* ssid = "XX";
const char* password = "XXX";
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>
void setup() {
Serial.begin(115200);
initiateNetwork();
thingsSpeakLogger();
}
void loop() {}
int thingsSpeakLogger(){
WiFiClient *client = new WiFiClient;
HTTPClient https;
String connectionString = "http://192.168.1.200/postparam.php";
if (https.begin(*client, connectionString)) {
https.addHeader("Content-Type", "multipart/form-data");
Serial.println(https.POST("query1=12345&query2=134684&query3=1"));
Serial.println(https.getString());
delete client;
}
}
void initiateNetwork() {
WiFi.begin(ssid, password); delay(1000);
while (WiFi.status() != WL_CONNECTED) {
delay(300); Serial.print(".");
}
Serial.println("Conneted to Wifi. IP Address: " + String(WiFi.localIP().toString().c_str()) + " MAC address: " + String(WiFi.macAddress()));
}