After uploading the sketch I opened the serial monitor and see a successful connection. However I don't see the result of the google search on "arduino". Please help me understand. :%
connecting...
connected
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 30 Nov 2012 13:29:35 GMT
Content-Type: text/html
Connection: close
Vary: Accept-Encoding
Expires: Fri, 30 Nov 2012 13:29:34 GMT
Cache-Control: no-cache
<html><head><meta http-equiv="refresh" content="0;url=http://dnssearch.rr.com/index.php?origURL=http://_/search"/></head><body><script>window.location="http://dnssearch.rr.com/index.php?origURL="+escape(window.location)+"&r="+escape(document.referrer);</script></body></html>
disconnecting.
/*
Web client
This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
modified 9 Apr 2012
by David A. Mellis
*/
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0x97, 0x39};
IPAddress server(198,105,251,46); // www.google.com
//IPAddress server(66,152,109,110); //both work: nslookup
// 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);
// 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:
for(;;)
;
}
// 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 /search?q=arduino HTTP/1.0");
client.println();
}
else {
// if 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:
for(;;)
;
}
}
You should be able to perform that same search. Paste http://198.105.251.46/search?q=arduino
in your browser. I'm behind a firewall now that is blocking that IP address, but does not block google. Does it give you the correct results? Where does the reply indicate it is coming from?
that's what i see using nslookup in the command prompt. The given IP within the example failed for me, so I took this approach.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\encryptor>nslookup www.google.com
Server: dns-cac-lb-01.rr.com
Address: 209.18.47.61
Non-authoritative answer:
Name: www.google.com.stny.rr.com
Addresses: 198.105.251.46
66.152.109.110