Hello everyone,
I would like to remotely control an LED reading a string from a server (GET or POST). NO LOCALHOST
check the value of the incoming string from the server and activate the LED.
page in php performs a check on the variable and returns "1" or "'0"
The following part of the script:
#include <GSM.h>
#define PINNUMBER ""
// APN information obrained from your network provider #define GPRS_APN "GPRS APN" // replace with your GPRS APN #define GPRS_LOGIN "LOGIN" // replace with your GPRS login #define GPRS_PASSWORD "PASSWORD" // replace with your GPRS password
I presume that you mean that you want to collect the output from the script running on the server.
if (client.available()) {
char c = client.read();
Serial.print(c);
}
This code should be a while statement, not an if statement, and should be in a if(client.connected()) block.
To save the data in an array is pretty simple, isn't it?
THIS IS RESULT:
HTTP/1.1 302 Found
Which means that the script is not where you think it is, but it left a forwarding address. The script was NOT run, so collecting that data in an array seems pointless.
Was there something different in the two parts you redacted?
client.println("Host: http://mydomain.com");
The http:// part defines the protocol to use to talk to the host. It is NOT part of the host name OR the POST request.