Ethernetshield is not making a web request

Hi! i recently bought an ethernet shield for my arduino and have tested it via the webclient example. Now it says it has connected when it try client.connect(server, 80); but when i try to run a webpage with client.println(); it doesn't work. When i go to my webpage via the browser it does work, so the PHP code is fine. I tried to find the solution with Google but no luck yet.

The idea is that the arduino just tells the webpage to run and the webpage does some stuff with PHP and a database, i don't have to return anything to the arduino script.

My question is am i doing this the right way or should i approach it differently, like with processing?

This is the code i have now:

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xC0, 0x1F };
char server[] = "http://www.signtec.nl";

EthernetClient client;

void setup() {

 // Open serial communications and wait for port to open:
  Serial.begin(9600);

 if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }

delay(2000);

if (client.connect(server, 80)) {
    Serial.println("connected");  // The serial shows 'connected'

    // This doesn't seem to run my webpage
    client.println("POST /?q=test HTTP/1.1");
    client.println("Host: www.signtec.nl");
    client.println("User-Agent: Arduino");
    client.println("Connection: close");
  }
  else {
     Serial.println("connection failed");
  }
}

void loop() {
}

This is a GET type request when the data is in the URL; POST is a bit more complicated and only needed with you're sending more than 65K characters of data. Second, you need to send a blank line after your HTTP request to signify that the request is complete.

    client.println("GET /?q=test HTTP/1.1");
    client.println("Host: www.signtec.nl");
    client.println("User-Agent: Arduino");
    client.println("Connection: close");
    client.println();

You could shorten this down to:

    client.println("GET /?q=test HTTP/1.0");
    client.println("Host: www.signtec.nl\n");

Note the change to HTTP/1.0 so you don't need to state "Connection: close" and also how I added the "\n".

Thanks, i made the changes to my code but unfortunately the webpage still doens't receive the request.

Isn't there a way to check if the request was sent and received, or is there another way to run a webpage from an ethernet shield?

Thanks!

Maybe if you sent the request, then read the response you could figure out why it isn't working. Try this code snippet.

  if (client.connect(server, 80)) {
    Serial.println("connected");
    // send request
    client.println("GET /?q=test HTTP/1.1");
    client.println("Host: www.signtec.nl");
    client.println("Connection: close\r\n");

    // read response
    while(client.connected()) {
      while(client.available()) {
        Serial.write(client.read());
      }
    }    
    client.stop();
    Serial.println("\r\ndisconnected");
  }
  else {
     Serial.println("connection failed");
  }