1

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.

1 Answer 1

1

You do it like any other POST. It's just you happen to be using a secure client to make the connection.

  1. Open the connection
  2. Send the right headers, including a Content-Type and Content-Length and maybe a Content-Encoding if you encode it.
  3. Send the body

It's not any different to an unencrypted POST request.

3
  • 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, 2019 at 11:58
  • Just look at any post request available on any of the millions of examples.
    – Majenko
    Apr 12, 2019 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, 2019 at 12:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.