1

I have connected the Ethernet Shield to the Arduino Uno Board and do get the following error when I execute the WebClient program. Look like it's getting connected to the internet, because I am getting a response back. But, this is not the response I was expecting in the Serial console.

Can someone please help me?

connecting...
connected
HTTP/1.0 302 Found
Location: http://www.google.co.in/search?q=arduino&gws_rd=cr&ei=ap_2VJL0JqW_mwWc7IG4DQ
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=8d5e7471bdf891d2:FF=0:TM=1425448810:LM=1425448810:S=-gaX4w3RUPOn7YjK; expires=Fri, 03-Mar-2017 06:00:10 GMT; path=/; domain=.google.com
Set-Cookie: NID=67=WNjkn45lMWxFTVOlW_qv6YQonIaJjd3_Aakemy7ddZ7_JqmPgaZPv_aGdqE8OptRIeV2vrYlFZRo1us7JgmnSJlmO0mfGdSNxEckDkAsqXcL7r-S7jU04eiH_zl8Q39_; expires=Thu, 03-Sep-2015 06:00:10 GMT; path=/; domain=.google.com; HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Date: Wed, 04 Mar 2015 06:00:10 GMT
Server: gws
Content-Length: 281
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic,p=0.08

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.co.in/search?q=arduino&amp;gws_rd=cr&amp;ei=ap_2VJL0JqW_mwWc7IG4DQ">here</A>.
</BODY></HTML>

disconnecting.
  • You should learn HTTP protocol: you get a 302 status that gives you a new URL Location that will give you the expected result. – jfpoilpret Mar 4 '15 at 7:41
  • @jfpoilpret I should have been a bit more explicit in the OP. The requested URL and the new URL in the response are all the same. – Praveen Sripati Mar 4 '15 at 7:50
  • OK, then did you copy the cookies set in the first response into the headers of the second request? Not sure how Google uses them but they are probably here for something... – jfpoilpret Mar 4 '15 at 8:41
  • nope - I am not setting the cookies - just calling the url – Praveen Sripati Mar 4 '15 at 9:04
  • 1
    Well I guess this is what's missing: your program should first perform the normal request, then if response is 302, get the new location AND the cookies, prepare a nrew request to this location and send along the previous cookies; I think the last response should be OK then. – jfpoilpret Mar 4 '15 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.