"位置参数"使用cURL发布数据时出错

时间:2015-01-24 18:40:48

标签: php curl http-post

如果我在没有--data "..."的情况下发出命令,它就可以了。我已经尝试了谷歌,但我无法找到这个问题的任何答案。按照位置here的指示,当我尝试使用cURL发布数据时,我收到以下错误:

PS C:\Users\David> curl --data "SMethod=0" "http://localhost/terra/modules/scripts/Query.php"
Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'SMethod=0'.
At line:1 char:1
+ curl --data "SMethod=0" "http://localhost/terra/modules/scripts/Query.php"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

2 个答案:

答案 0 :(得分:6)

您的问题在这里得到解答:Running cURL on 64 bit Windows

你没有运行curl你正在运行一个叫做Invoke-WebRequest的东西,这个别名是卷曲的。你需要unalias curl,download并安装curl(如果你还没有)。

答案 1 :(得分:1)

Remove-item alias:curl

这很容易发生卷曲!

尝试和娱乐。而且curl也可以自己制作 SHORTEN URL,因此无需与第三方合作。。:D

相关问题