How do I send an HTTP POST with curl?

ewok picture ewok · Oct 21, 2011 · Viewed 12.5k times · Source

I am attempting to access the Google Search Appliance API: http://code.google.com/apis/searchappliance/documentation/612/gdata/acapi_protocol.html

In order to send the requests, I am using curl. My problem is that when I attempt to login, using

curl -k -X POST https://ip.ad.dr.ess:8443/accounts/ClientLogin&Email=username&Passwd=password

I get the following:

'Email' is not recognized as an internal or external command,
operable program or batch file.
Passwd: unknown user =password

Any help with this problem would be greatly appreciated. I am new to curl, so I realize I am probably using it wrong.

I have curl installed through cygwin on Windows 7.

Answer

rhololkeolke picture rhololkeolke · Oct 21, 2011

I'm pretty sure you have to do something along the lines of

curl -k -X POST https://ip.ad.dr.ess:8443/accounts/ClientLogin -d Email=username -d Passwd=passwd

For a list of command options see http://curl.haxx.se/docs/manpage.html#-d