title: Arduino Getting Data From Web Page
body: <p>I'm trying to connect my Arduino uno + Ethernet shield to a php script that gets a value from a database and then is sent back which then is displayed on a serial monitor. It works, it connects successfully and i get the value sent back however I'm having trouble displaying it on the serial monitor. It should just display what the server sends however it doesn't. Any one can help?</p>
  
  <p>The Serial Output : It should just output "The Value", however there are numbers that shouldn't be there. If i output this to a LCD monitor i can't have them numbers present.</p>
  
  <pre><code>connecting...
  connected
  HTTP/1.1 200 OK
  Server: cloudflare-nginx
  Date: Sat, 04 Jan 2014 15:36:51 GMT
  Content-Type: text/html
  Transfer-Encoding: chunked
  Connection: close
  Set-Cookie: __cfduid=dcef101052b82760c1a2de019e6b076141388849811461; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.linku.biz; HttpOnly
  X-Powered-By: PHP/5.3.27
  CF-RAY: e7901b6dec606e2
  
  4
  The 
  5
  Value
  0
  
  
  disconnecting.
  </code></pre>
  
  <p>PHP Script</p>
  
  <pre><code>&lt;?php
  echo 'The Value';
  ?&gt;
  </code></pre>
  
  <p>Arduino Script</p>
  
  <pre><code>#include &lt;SPI.h&gt;
  #include &lt;Ethernet.h&gt;
  
  // Enter a MAC address for your controller below.
  // Newer Ethernet shields have a MAC address printed on a sticker on the shield
  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
  
  
  char server[] = "www.linku.biz";    // name address for Google (using DNS)
  
  // Set the static IP address to use if the DHCP fails to assign
  IPAddress ip(192,168,0,177);
  
  // Initialize the Ethernet client library
  // with the IP address and port of the server 
  // that you want to connect to (port 80 is default for HTTP):
  EthernetClient client;
  
  void setup() {
   // Open serial communications and wait for port to open:
    Serial.begin(9600);
     while (!Serial) {
      ; // wait for serial port to connect. Needed for Leonardo only
    }
  
    // start the Ethernet connection:
    if (Ethernet.begin(mac) == 0) {
      Serial.println("Failed to configure Ethernet using DHCP");
      // no point in carrying on, so do nothing forevermore:
      // try to congifure using IP address instead of DHCP:
      Ethernet.begin(mac, ip);
    }
    // give the Ethernet shield a second to initialize:
    delay(1000);
    Serial.println("connecting...");
  
    // if you get a connection, report back via serial:
    if (client.connect(server, 80)) {
      Serial.println("connected");
      // Make a HTTP request:
      client.println("GET /arduino.php HTTP/1.1");
      client.println("Host: www.linku.biz");
      client.println("Connection: close");
      client.println();
    } 
    else {
      // kf you didn't get a connection to the server:
      Serial.println("connection failed");
    }
  }
  
  void loop()
  {
    // if there are incoming bytes available 
    // from the server, read them and print them:
    if (client.available()) {
      char c = client.read();
      Serial.print(c);
    }
  
    // if the server's disconnected, stop the client:
    if (!client.connected()) {
      Serial.println();
      Serial.println("disconnecting.");
      client.stop();
  
      // do nothing forevermore:
      while(true);
    }
  }
  </code></pre>