Ethernet shield data usage?

Now that my arduino is acting as a we bclient, how do I take the data it gets back and do things with it?

if (clientoutput == “it works”) {

My Arduino code:

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 30 };
byte server[] = { 192, 168, 1, 31 };
//char getdata = '1';
Client client(server, 80);

void setup()
  Ethernet.begin(mac, ip);
  if (client.connect()) {
    client.println("GET /script.php?getdata=1 HTTP/1.0");
    //client.println(" HTTP/1.1");
  } else {
    Serial.println("connection failed");

void loop()
  if (client.available()) {
    char c =;
  if (!client.connected()) {

PHP code



if ($_GET[getdata] == "1") {

echo "it works";

} else {

echo "no var";



on wich OS are you on?

Windows = a no go... Mac = Do'nt really know i never had a mac (because i think they suck). Linux = a YES.

SaSaa, I don’t think your reply is in the least helpful. Firstly, platform doesn’t matter - I reckon I could get php to pipe data to whatever application I want on any system it’ll run on.

Secondly, I don’t think that’s what the original poster was after.

tehjrow - have a look at at the counter project. It polls a php site for data, then actions it. This is the main bit of the code:

  client.println("GET /url.php HTTP/1.0");
  while (foo<8) {  //dump unwanted lines
    while ( != '\n') { }
  if ( == 'Y') {
    return true;
  } else {
    return false; 

What it does:
connect to a website (url.php).
the first eight lines are header info - not the HTML you’re expecting. I don’t know if this varies by server so you might want to check, but on my server the first eight lines are rubbish so I dump them.
Check the contents of the HTML. In this case, it’s either a Y or N (no html layout or anything, just a Y or N).
the code is part of a function. If a Y is receive it returns true.

You might also want to look at the twitter code on - very similar technology but the grab from the URL is more complex.

Actually, his reply does contain some useful reminders, if you've been around the forum for a while.

On Windows, PHP can't read from the serial port. This is not a limitation of PHP as much as it is the fact that the brain dead morons up the road at Microsoft didn't think that reading from the serial port is something that an non-Microsoft application needs to be able to do, so the necessary APIs are not exposed (or just don't work).

On Linux, PHP can read from the serial port.

This is not a limitation of PHP…

Well, yes it is. As best as I remember, PHP was developed to make dynamic web pages, generally sending/receiving and slicing/dicing information from various types of files with no mention of hardware I/O operations. PHP’s only connection to the serial port on windows is that on windows one can send data to the serial port (com1, etc) as it appears as a file when accessed in ths format. PHP apparently accesses the serial port the same as the below batch file. If one wants to serial port I/O operations on windows, then one can use an appropriate application made to do the job.

@echo off
echo Hello World >com1