Unix中的curl命令引发异常

Unix中的curl命令引发异常,curl,Curl,我正在执行下面的curl命令并得到错误: curl -Method Post -Header @{'Content-Type'='application/x-www-form-urlencoded'}-Body @{grant_type = 'password';username = 'abcd';password = 'xyz'} "http://someaddress/api/oauth/token" -O test_curl 你能检查一下我在这里做错了什么吗 错误: Warning: b

我正在执行下面的curl命令并得到错误:

curl -Method Post -Header @{'Content-Type'='application/x-www-form-urlencoded'}-Body @{grant_type = 'password';username = 'abcd';password = 'xyz'} "http://someaddress/api/oauth/token" -O test_curl
你能检查一下我在这里做错了什么吗

错误:

Warning: built-in manual was disabled at build-time!
curl: option -Method: is unknown
curl: try 'curl --help' for more information

-Method
选项应为
-X
-request
-Header
选项应为
-H
-Header
。此外,必须使用双引号将带有单引号的JSON头传递给
curl

试试这个:

curl -XPOST -H "@{'Content-Type'='application/x-www-form-urlencoded'}-Body @{grant_type = 'password';username = 'abcd';password = 'xyz'}" -o test_curl "http://someaddress/api/oauth/token"

是…你刚刚做出的选择?!那是什么语法?这里真的有点奇怪。我从未使用过curl,所以不知道是否有单独的curl控制台来运行该命令。我尝试了这个命令并得到了错误。curl:(7)无法连接到主机curl:(6)无法解析主机“test_curl”编辑的打字错误。请重试。现在只出现一个错误:curl:(7)无法连接到主机。我从/home/username运行它,并在这个路径中创建了test\u curl。您使用的是哪台主机?不要像示例中那样使用
someaddress
。不,这是一个伪地址。。我用的是正确的。