Powershell:Webclient是无法上载字符串

2024-10-02 02:30:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我的https POST请求在UNIX和python上使用curl,使用以下命令:

p=subprocess.Popen(['curl','-s','-k','-X','POST', '-H','Content-Type: application/json','-d',message,<https link>],stdout=subprocess.PIPE)

它可以向web服务器发送任何字符串。现在,我希望在Windows上也能使用powershell。我做了以下工作:

^{pr2}$

但是,它失败了:

Exception calling "UploadString" with "2" argument(s): "The underlying connection was     closed: Could not establish trust relationship for the SSL/TLS secure channel."
At line:1 char:24
+ $webclient.UploadString <<<< ("https://host/message","strng in json format");
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

我有什么遗漏吗?任何帮助都将不胜感激。在

提前谢谢!在

乔伊


Tags: https命令jsonmessageapplicationtypestdoutlink

热门问题