“Positional Parameter” error when posting data with cURL

纵饮孤独 提交于 2021-02-06 08:50:20

问题


If I were to issue the command without the --data "...", it works just fine. I've tried Google and I can't find any answers to this problem. Following the directions located here I'm getting the following errors when I attempt to post data with 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

回答1:


Your problem is answered here: Running cURL on 64 bit Windows

You're not running curl you're running something called Invoke-WebRequest, which is aliased to curl. You need to unalias curl, download and install curl (if you haven't already).




回答2:


Remove-item alias:curl

this will be happen to curl easily!!

TRY AND FUN.. AND ALSO curl can make your own SHORTEN URL , so Don't need to work with 3rd parties.. :D



来源:https://stackoverflow.com/questions/28128918/positional-parameter-error-when-posting-data-with-curl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!