Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a search page in a form http://site.com/search.php and it sends a search query via POST request. I want to fetch this request via curl command line tool to inspect a POST request.

The HTML form looks like this:

<form action="search.php" method="POST">
   <input type="text" name="search" size=20><br>
   SZ<input type="checkbox" checked name="sz">
   NZ<input type="checkbox" checked name="nz">
   <input type="submit" name="search_term" value="search" >

How should my curl command look like?

share|improve this question
Curl is an HTTP client - it makes requests (aka fetching resources). It can't intercept a POST from another client, like your browser, which is what it sounds like you want to do. Or did you mean you want to make this POST request with curl? – ckhan Apr 30 '12 at 4:01
up vote 3 down vote accepted

As an example, to send a search of "foo" with sz checked and nz unchecked:

curl -d "search_term=search&search=foo&sz=on&nz=off" http://site.com/search.php
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.