Erik's Weblog 2.0

February 1, 2006

[@993]

Quick HTTP POST request

Have you ever wanted to quickly send a POST request to a HTTP server? It's pretty easy to do using curl.

For example to send XML via a POST request, you could use the following:
curl --header "Content-Type: text/xml" --data "...." http://www.foo.com/
I use this method for testing almost every day. Saves a lot time.

There's a tip entry in the wiki too.
[@693]

Another curl command I use often is:
curl -I http://www.example.com/
to get a HEAD request.

[@699]

And:
curl --header "Accept-Encoding: gzip" http://www.foo.com/ | gunzip
to get the compressed request.