I have a problem using ethernet shield on arduino!!

Hi, I just bought an ethernet shield that runs as w5100 and I have trouble using this.

I have successfully built php and mysql and

when I type

localhost/arduino/test.php?sensor1=50

in the address bar on internet, it works fine and store "50" into the database and displays on the localhost website.


#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 169,254,15,174 };
byte server[] = { 127, 0, 0, 1 };

float sensor1 = 5;

EthernetClient client;

void setup()
{
Serial.begin(9600);
Ethernet.begin(mac, ip);
}

void loop()
{
if(client.connect(server, 80))
{
Serial.println("Connected");
client.print("GET /arduino/test.php?");
client.print("sensor1=");
client.print(sensor1);
}
else
{
Serial.println("Connection failed");
}
}

The ip address assigned above is what i found on my System Preferences - Network on my macbook.

I plugged ethernet cable right into my macbook and the new network came up. It the ip address of this as shown in the picture attached.

The server address assigned above is I think the localhost address.

I thought everything was correct, but when I upload, it prints "Connection Failed"

Please help!

The IP 127.0.0.1 is localhost. It is accessible only from the computer the server software is running on. You must use the IP of the computer, probably a 169.254.x.x IP.