0

I have a setup which uses the ESP8266 12E and it opens a web server at a specific port 200. I have used the port forwarding to route the incoming data to this server .And I have used the duckdns to register the IP and call the duckdns domain to trigger the ESP. This works fine and I am able to trigger using the following

http://mydomain.duckdns.org:200/parseIFTTT

Using the postman tool, with the contentType as plain/text and the method as POST what ever contents I pass are getting parsed by parseIFTTT method in the ESP

 void parseIFTTT() {

  String message;
  message += server.args();
  message += "\n";
  for (uint8_t i = 0; i < server.args(); i++) {
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  Serial.println(message);
  server.send(200, "text/plain", "Success");
}

But when tried to integrate with IFTTT for any Facebook or gmail events, I am not able to parse the data from IFTTT.

The request goes to ESP8266 but the request data I am not able to parse.

The following is the request :

URL : http://mydomain.duckdns.org:200/parseIFTTT
Method : POST
Content Type: text/plain
Body : {{Message}}

In the body I have just added the {{Message}} only. In the serial monitor I get the op as blank

1
plain:
4

1 回答 1

0

经过大量调试,我发现了这个问题。

Http 服务器的核心库中的 esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WebServer\src\Parsing.cpp 正在使用“Content-Length”,并且 IFTTT 正在发送名称为“content-length”的请求标头',因此没有检索到内容长度,也没有检索到解析的数据。

不确定 IFTTT 是否存在问题,他们将其作为小写值发送。

于 2016-05-29T04:53:36.447 回答