如何使用curl 发送HTTP POST?
我正在尝试访问 Google Search Appliance API:http:// code.google.com/apis/searchappliance/documentation/612/gdata/acapi_protocol.html
为了发送请求,我使用了curl。我的问题是,当我尝试登录时,使用
curl -k -X POST https://ip.ad.dr.ess:8443/accounts/ClientLogin&Email=username&Passwd=password
我得到以下信息:
'Email' is not recognized as an internal or external command,
operable program or batch file.
Passwd: unknown user =password
任何有关此问题的帮助将不胜感激。我是卷曲新手,所以我意识到我可能使用错误。
我在 Windows 7 上通过 cygwin 安装了curl。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我很确定你必须按照以下方式执行一些操作
对于命令选项列表,请参阅
http://curl.haxx.se/docs/manpage.html#-d
I'm pretty sure you have to do something along the lines of
For a list of command options see
http://curl.haxx.se/docs/manpage.html#-d
尝试用
"
括起您的 URL。由于您使用的是&
和其他特殊 bash 字符,您需要将它们括在引号中。这是一个 bash 问题:
Try enclosing your URL with
"
. Since you are using&
and other special bash characters you need to enclosed them in quotes.It's a bash issue:
shell 解释 &字符作为命令的结尾:您需要将整个 URL 放在引号中
The shell interprets the & character as the end of a command: you need to put the whole URL in quotes