I want to access the following page on my local using my Arduino with ethernet shield" 192.168.1.2/zombie/arduino.php. My arduino is conencted to a PC through a router. The system keeps timing out
I am using the following code:
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1,3 };
char server[] = "192.168.1.2/zombie/arduino.php";
EthernetClient client;
void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
int res = client.connect(server, 80);
Serial.println(res);
if (res) {
Serial.println("connected");
client.println();
} else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.println("data:");
Serial.println(c);
}else{
Serial.println("NA");
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}