Communication between Arduino client with a website in a local server

Hello!
I'm making a home automation system using Arduino UNO + Ethernet shield as a client and a PC as a server.

I want to control several elements in a house as lighting by a website programmed with HTML and PHP, for example turn on or turn off a light with a botton in the website.

The problem is that I don't know how I can send the orders to the Arduino, I think I have to open the connection and ask for the value of the botton using GET, but how I can implement that type of botton in the webpage?

Any ideas??? Thank you!

The "Playground" section of this site would be a good place for you to start. Here is a link to the "Interfacing" section:

http://playground.arduino.cc/Main/InterfacingWithHardware#Communication

The problem is that I don't know how I can send the orders to the Arduino, I think I have to open the connection and ask for the value of the botton using GET, but how I can implement that type of botton in the webpage?

You need to make a clear distinction of what is to be the client and what is to be the server. A web page with control buttons is fairly simple and it sends a GET request to a server. I'm not sure how an arduino acting as a client will play into your system. The server, weather the arduino or pc, will do something based on the GET request it receives. The arduino can act as an event based client making a GET request to a server, but not sure if this is part of your plan. If you search, people have previously made very involved web based control setups for homes, aquariums, and similar systems.

zoomkat:
You need to make a clear distinction of what is to be the client and what is to be the server. A web page with control buttons is fairly simple and it sends a GET request to a server. I'm not sure how an arduino acting as a client will play into your system. The server, weather the arduino or pc, will do something based on the GET request it receives. The arduino can act as an event based client making a GET request to a server, but not sure if this is part of your plan. If you search, people have previously made very involved web based control setups for homes, aquariums, and similar systems.

Yes it is my plan, I want the Arduino act as an event based client. Here is my Arduino code but I don't know how I can make the php code in my web page to send the data, could you help me with the code of the buttons?

void LightControl(){
   // if you get a connection, report back via serial:
    client.stop();
  // if there's a successful connection:
  if (client.connect(server, 80)) {
    Serial.println("connecting...");
    // send the HTTP PUT request:
    client.print("GET /House/Lighting.php");
    client.print("HTTP/1.1");
    client.println("Host: 192.168.1.108");
    client.println("Connection: close");
    client.println();
  }
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");
    
   // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    cadena += c;
    Serial.print(c);
    
    //LED stored the position of the first character.
            int LED = cadena.indexOf("LED="); 
          // if the substring from the position LED until LED + 5 is equal then turn on the LED.
          if(cadena.substring(LED,LED+5)=="LED=T") { 
            Serial.println("on");
            led.on();
            estado=true;
          } else if(cadena.substring(LED,LED+5)=="LED=F"){
            led.off();
            estado=false;
            Serial.println("off");
          } else if(cadena.substring(LED,LED+6)=="LED=25"){
            led.brightness(256);
            Serial.println("25");
          } else if(cadena.substring(LED,LED+6)=="LED=50"){
            led.brightness(512);
            Serial.println("50");
          } else if(cadena.substring(LED,LED+6)=="LED=75"){
            led.brightness(768);
            Serial.println("75");
          } else if(cadena.substring(LED,LED+7)=="LED=100"){
            led.brightness(1023);
            Serial.println("100");
          }
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    cadena="";

    // do nothing forevermore:
    while (true);
  }
  }

}