我正在尝试将 HTTPS 发布到 Microsoft Flow。
我可以像这样使用 apister.com 发布到 Flow;我试图用 ESP8266 复制这个但有问题。我找到了以下示例 -
https://github.com/esp8266/Arduino/issues/2834这是我的代码
代码:
全选#include //https://github.com/esp8266/Arduino
#include
#include
#include
#include //https://github.com/tzapu/WiFiManager
#include
void setup() {
Serial.begin(115200);
Serial.println(\"Attemp
ting to connect to wifi\");
WiFiManager wifiManager;
//wifiManager.resetSettings(); //reset saved settings
wifiManager.autoConnect(\"AutoConnectAP\");
Serial.println(\"connected\");
}
void loop() {
Serial.println(\"attempt POST\");
HTTPClient http;
http.begin(\"https://prod-23.westeurope.logic.azure.com:443/workflows/4221219928b1479186337912abba9907/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=FxDTZGTHI1iF784ILXLXM707U0TonG_j_xxxxxxxxxxx\");
http.addHeader(\"Content-Type\", \"application/json\");
String postMessage = \"{\'temp\':\'21\'}\";
int httpCode = http.POST(postMessage);
Serial.print(\"http result:\");
Serial.println(httpCode);
http.writeToStream(&Serial);
String payload = http.getString();
http.end();
delay(5000); //Post Data at every 5 seconds
}
我唯一的输出是;
代码:
全选Attempting to connect to wifi
*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.43.166
connected
*WM: freeing allocated params!
attempt POST
http result:-1
0