I’m trying to do a POST to an extremely simple php file
It works if I do not set request headers, but since the data is json I need to set the content type.
This is my content I send
AT+QHTTPPOST=225,80,80
and the content:
POST / HTTP/1.1
HOST: api2.cloudfors.dk
Accept: /
Connection: Keep-Alive
Content-Type: application/json
Content-Length: 100
{“uuid”:“865263041608058”,“model”:“CFDetect RH04M2”,“position”:{“lat”:“1”,“lng”:“1”},“ch”:“1,1,1,1”}
What I receive is 3822
Thanks in advance
I found out now, that as soon as I add requestheader, it keeps waiting for input until it times out and returns the error.
I have ensured though, that the 225 is what I’m sending. And that Content-Length is correct.
Is there a specific character I need to send to end the body?
And, now I figured it out.
I waited for CONNECT after sending QHTTPPOST, as I should, and then I sent headers and data.
But as it turned out, just waiting for CONNECT is not enough. I inserted a delay of 300 ms after receiving CONNECT and then it worked