Thomas Thomas - 11 days ago 5x
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?


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 \