Is there a way to post HTTPS body request in Arduino esp8266. I am able to HTTPS parameter request with WifiClientSecure library,but is not safe compared to Request Body send in POST.
You do it like any other POST. It's just you happen to be using a secure client to make the connection.
- Open the connection
- Send the right headers, including a
Content-Type
andContent-Length
and maybe aContent-Encoding
if you encode it. - Send the body
It's not any different to an unencrypted POST request.
-
Can you provide me some example? or the format to include Request body with a Content-Type and Content-Length and maybe a Content-Encoding as you said in point 2 – Rohit Apr 12 '19 at 11:58
-
Just look at any post request available on any of the millions of examples. – Majenko♦ Apr 12 '19 at 12:02
-
client.print(String("POST ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n"+ "Content-Length: " + data.length() + "\r\n" + "Content-Type: application/json;charset=UTF-8\r\n\r\n"+ data +"\r\n"); data variable will contain json body? Will this work?? – Rohit Apr 12 '19 at 12:04