Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl www.google.com works differently when the url is called from browser directly

Tags:

curl

When I type curl www.google.com in the terminal I get the below reply. But when I type the similar url(www.google.com) in browser(chrome) I get redirected to www.google.co.in

Why am I not able to see the below HTML when I call the same URL from browser?

<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/">here</A>.
</BODY></HTML>
like image 400
Amit Avatar asked Jul 19 '12 15:07

Amit


1 Answers

curl -L http://www.google.com

Will make curl follow redirects and you will recieve actual search page.

like image 86
Sergey Eremin Avatar answered Sep 19 '22 07:09

Sergey Eremin