WebClient problem contacting HTTP Server Page

Hi there. I am expieriencing a problem connecting to arduino.cc/latest.txt webpage via my Ethernet board.

I am just copy pasting arduino’s example and changing my IP to my networks IP address.
Why is that happening? What should I enter in “myDns”? I just tracert the webpages IP address.
Is that right?

and the code from the example…

/*
  Repeating Web client
 
 This sketch connects to a a web server and makes a request
 using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
 the Adafruit Ethernet shield, either one will work, as long as it's got
 a Wiznet Ethernet module on board.
 
 This example uses DNS, by assigning the Ethernet client with a MAC address,
 IP address, and DNS address.
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 
 created 19 Apr 2012
 by Tom Igoe
 
 http://arduino.cc/en/Tutorial/WebClientRepeating
 This code is in the public domain.
 
 */

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

// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = { 
  0xDE, 0xAC, 0xBD, 0xEF, 0xFE, 0xED};
// fill in an available IP address on your network here,
// for manual configuration:
IPAddress ip(192,168,10,170);

// fill in your Domain Name Server address here:
IPAddress myDns(1,1,1,1);

// initialize the library instance:
EthernetClient client;

char server[] = "www.arduino.cc";

unsigned long lastConnectionTime = 0;          // last time you connected to the server, in milliseconds
boolean lastConnected = false;                 // state of the connection last time through the main loop
const unsigned long postingInterval = 2*1000;  // delay between updates, in milliseconds

void setup() {
  // start serial port:
  Serial.begin(9600);
  // give the ethernet module time to boot up:
  delay(1000);
  // start the Ethernet connection using a fixed IP address and DNS server:
  Ethernet.begin(mac, ip, myDns);
  // print the Ethernet board/shield's IP address:
  Serial.print("My IP address: ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging
  // purposes only:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if there's no net connection, but there was one last time
  // through the loop, then stop the client:
  if (!client.connected() && lastConnected) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
  }

  // if you're not connected, and ten seconds have passed since
  // your last connection, then connect again and send data:
  if(!client.connected() && (millis() - lastConnectionTime > postingInterval)) {
    httpRequest();
  }
  // store the state of the connection for next time through
  // the loop:
  lastConnected = client.connected();
}

// this method makes a HTTP connection to the server:
void httpRequest() {
  // if there's a successful connection:
  if (client.connect(server, 80)) {
    Serial.println("connecting...");
    // send the HTTP PUT request:
    client.println("GET /latest.txt HTTP/1.1");
    client.println("Host: www.arduino.cc");
    client.println("User-Agent: arduino-ethernet");
    client.println("Connection: close");
    client.println();

    // note the time that the connection was made:
    lastConnectionTime = millis();
  } 
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");
    Serial.println("disconnecting.");
    client.stop();
  }
}

If you are using a client sketch, maybe you should use dhcp to get the correct network settings.

// replace this
  Ethernet.begin(mac, ip, myDns);
// with this
  if(!Ethernet.begin(mac)) Serial.println("dhcp failed");

It got it working but i am experiencing another problem. I can get text from a .txt file correctly but when I try from a .php file I get some more characters. Its a problem in parsing.

Debugging using .txt file:

HTTP/1.1 200 OK
Date: Fri, 07 Feb 2014 15:57:02 GMT
Server: Apache/2.2.14 (Ubuntu)
Last-Modified: Fri, 07 Feb 2014 15:50:56 GMT
ETag: "2485f7-4-4f1d2f4a49f11"
Accept-Ranges: bytes
Content-Length: 4
Vary: Accept-Encoding
Connection: close
Content-Type: text/plain

1478
disconnecting.

Debugging using .php file:

connecting...connected
HTTP/1.1 200 OK
Date: Fri, 07 Feb 2014 15:58:28 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.22
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

4
1478
0


disconnecting.

Looks like your php doc is returning extra characters. Hard to tell from here without seeing the php code.