Skip to main content
added 289 characters in body
Source Link
Majenko
  • 105.9k
  • 5
  • 82
  • 139

Your problem is here:

client.print(" ");      //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.print("Host: ");
 client.println(server);
client.println("Host: 192.168.0.14");//eg: 192.168.0.222
client.println("Connection: close");
client.println();

That ends up with:

....(your request)... HTTP/1.1Host: 192.168.0.14
Host: 193.168.0.14
Connection: close

Not only are you sending the Host header twice, but you're not adding the line ending after the HTTP version.

Instead it should look more like:

client.print(" ");      //SPACE BEFORE HTTP/1.1
client.println("HTTP/1.1"); // <-- Note the use of println not print
client.print("Host: ");
client.println(server);
client.println("Connection: close");
client.println();

Your problem is here:

client.print(" ");      //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.print("Host: ");
 client.println(server);
client.println("Host: 192.168.0.14");//eg: 192.168.0.222
client.println("Connection: close");
client.println();

That ends up with:

....(your request)... HTTP/1.1Host: 192.168.0.14
Host: 193.168.0.14
Connection: close

Not only are you sending the Host header twice, but you're not adding the line ending after the HTTP version.

Your problem is here:

client.print(" ");      //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.print("Host: ");
 client.println(server);
client.println("Host: 192.168.0.14");//eg: 192.168.0.222
client.println("Connection: close");
client.println();

That ends up with:

....(your request)... HTTP/1.1Host: 192.168.0.14
Host: 193.168.0.14
Connection: close

Not only are you sending the Host header twice, but you're not adding the line ending after the HTTP version.

Instead it should look more like:

client.print(" ");      //SPACE BEFORE HTTP/1.1
client.println("HTTP/1.1"); // <-- Note the use of println not print
client.print("Host: ");
client.println(server);
client.println("Connection: close");
client.println();
Source Link
Majenko
  • 105.9k
  • 5
  • 82
  • 139

Your problem is here:

client.print(" ");      //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.print("Host: ");
 client.println(server);
client.println("Host: 192.168.0.14");//eg: 192.168.0.222
client.println("Connection: close");
client.println();

That ends up with:

....(your request)... HTTP/1.1Host: 192.168.0.14
Host: 193.168.0.14
Connection: close

Not only are you sending the Host header twice, but you're not adding the line ending after the HTTP version.