Thomas Thomas - 1 year ago 139
Linux Question

how to send a request to Google with curl

I work on Linux and try to use

to send requests to Google and save its reply as a html file.

When I use Google to search something, such as a string "abc", I find that the link of Google is:

So I try like this:

curl -o res.html

But the
is just the main page of Google, instead of the result of searching "abc".

How to do it?

Answer Source

Anything after the # is handled client side with JavaScript, which is why it doesn't work with curl.

You can instead use the traditional, non-AJAX interface on

It appears to block you unless you also spoof the user agent, so all in all:

curl \
  -A 'Mozilla/5.0 (MSIE; Windows 10)'  \
  -o res.html \ 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download