Hi all,
I am hoping I can get some pointers on what is going wrong with my sketch.
The project involves scanning an RFID tag. Upon scanning, the arduino will then call on a php script, that queries a sql DB, via GET to return and parse a result of either 0 or 1 (0 for no result and therefore denied or 1 for valid result and allowed ).
At the moment I am just stuck on the PHP get part and parsing the result to the arduino. Currenty it just says "no response received".
This is the sketch code
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,16);
EthernetClient client;
char server[] = "192.168.0.175";
void setup()
{
Serial.begin(9600);
// attempt a DHCP connection:
Serial.println("Attempting to get an IP address using DHCP:");
Ethernet.begin(mac, ip);
Serial.print("My address:");
Serial.println(Ethernet.localIP());
}
void loop()
{
// connect to the server
if (client.connect(server, 80))
{
// print to serial monitor
Serial.println("connected...");
Serial.println("ARDUINO: forming HTTP request message");
// send data the server through GET request
client.print("GET /test.php?taguid=54635363");
client.println(" HTTP/1.1");
client.print("HOST: ");
client.println(server);
Serial.println("ARDUINO: HTTP message sent");
// give server some time to receive and store data
// before asking for response from it
delay(5000);
// get the response from the page and print it to serial port
// to ascertain that data was received properly
if(client.available())
{
Serial.println("ARDUINO: HTTP message received");
Serial.println("ARDUINO: printing received headers and script response...\n");
while(client.available())
{
char c = client.read();
Serial.print(c);
}
}
else
{
Serial.println("ARDUINO: no response received / no response received in time");
}
client.stop();
}
// do nothing forever after:
while(true);
}
This is the output
My address:192.168.0.16
connected...
ARDUINO: forming HTTP request message
ARDUINO: HTTP message sent
ARDUINO: no response received / no response received in time
Have attached an image of the response I get via a browser.
Really hope someone can point me in the right direction. Have spent the last week researching and running over multiple examples and not really getting anywhere