Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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" >
</form>

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
add comment

1 Answer 1

up vote 2 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
add comment

Your Answer

 
discard

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.