卷曲http发布请求

时间:2018-10-26 15:34:53

标签: curl http-post

我正尝试根据网站文档发送发帖请求,如下所示: POST /WindchillQualitySolutions11.0/DataEngine.asmx/GetSessionToken HTTP / 1.1 主机:vm-test 内容类型:application / x-www-form-urlencoded 内容长度:长度

UserName = Bill&Password = passwd&GroupName = Manager&SecondsValid = 0

内部网站地址类似: http://itdabcSomeNumber/ptcwindchillqualitysolutions11.0/

我尝试的curl命令:

curl -H 'Host:itdabcSomeNumber' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Content-Length: length' -d 'UserName=myUserName&Password=MyPassWord&GroupName=Manager&SecondsValid=0' http://itdabcSomeNumber/WindchillQualitySolutions11.0/DataEngine.asmx/GetUserGroup

我收到以下错误: curl:(6)无法解析主机:应用程序 curl:(6)无法解析主机:length' 无法将“密码”识别为内部或外部命令, 可操作的程序或批处理文件。 无法将“ GroupName”识别为内部或外部命令, 可操作的程序或批处理文件。 无法将“ SecondsValid”识别为内部或外部命令, 可操作的程序或批处理文件。

我还尝试使用-H来输入用户名和密码,但它也不起作用。 任何人都可以告诉我发送请求的正确命令。

1 个答案:

答案 0 :(得分:0)

尝试

curl -X POST \
  http://server_or_ip/WindchillQualitySolutions11.0/DataEngine.asmx/GetSessionToken \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'UserName=Bill&Password=passwd&GroupName=Manager&SecondsValid=0'