void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;
;
}
}
The error is as follows:
connecting...
connected
HTTP/1.1 302 Found
Location: arduino - Google Search
Cache-Control: private
Content-Type: text/html; charset=UTF-8
P3P: CP="This is not a P3P policy! See P3P and Google's cookies - Google Account Help for more info."
Date: Tue, 22 Dec 2015 07:48:39 GMT
Server: gws
Content-Length: 281
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: NID=74=rYq-dcxYVf88IB0Xl-dv1oxFV7NFgvEYZHkny4gpzj3HVJzFtP6-W6R_MmNn_dzmRWHAlRZTOmKnNz0OqyloL9N7eKzp_p2jgKES0AEqVrmlxyEK2oClDZE-9hisLX6lBwicic69; expires=Wed, 22-Jun-2016 07:48:39 GMT; path=/; domain=.google.com; HttpOnly
Everything is working fine. You connect to the sever, and the sever gives you a 302 redirect. This means that you need to look at the "Location" header in the reply,
In answer to the obvious question "Why", the answer is: "that's the way that the website you have connected to works". Its a common pattern. The initial URL performs the search and stores the results of the search in a temporary bucket that you can page through. The second url is page 1 of the bucket. The bucket will remain in existence for a period of time - a few minites. If you go there after that period of time, you get a message "Your search results have expired".
If you want a machine to talk to google, then it would be better off using the JSON interface. You'll grt back the results of the search without all the HTML razamatazz.