Http get command does not work the same than with a computer
Posted: Mon Jan 23, 2017 12:06 am
Hello,
I am trying to send Http get to a camera ( Olympus AIR) . It work quite well from a computer : This is the wireshark trace :
So its http://192.168.0.10/get_commandlist.cgi
with the following header :
Host:192.168.0.10
User-Agent:OlympusCameraKit
So my code is :
But the answer is 404 for Http error 404 as oppose of a xml result as i get when i do the same request from my computer.
I am trying to send Http get to a camera ( Olympus AIR) . It work quite well from a computer : This is the wireshark trace :
So its http://192.168.0.10/get_commandlist.cgi
with the following header :
Host:192.168.0.10
User-Agent:OlympusCameraKit
So my code is :
Code: Select all
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
ESP8266WiFiMulti WiFiMulti;
void setup() {
Serial.begin(115200);
delay(10);
Serial.print("Wait for WiFi... ");
while(WiFiMulti.run() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
delay(500);
}
void loop() {
HTTPClient http;
http.begin("http://192.168.0.10/get_commandlist.cgi");
http.addHeader("Host","192.168.0.10",true,true);
http.addHeader("User-Agent","OlympusCameraKit");
http.addHeader("Connection","KeepAlive");
int httpCode = http.GET();
Serial.println(httpCode);
String payload = http.getString();
Serial.println(payload);
http.end();
delay(5000);
}
But the answer is 404 for Http error 404 as oppose of a xml result as i get when i do the same request from my computer.