如何在PowerShell中使用HTTP GET? [英] How to use HTTP GET in PowerShell?
本文介绍了如何在PowerShell中使用HTTP GET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
获取$ webclient.downloadstring以写入Powershell中的文本文件
Powershell http post with .cer for auth
我有一个短信系统,可以让我从HTTP GET请求发送短信:
I have an SMS system that provide me the ability to send SMS from an HTTP GET request:
http://smsserver/SNSManager/msgSend.jsp?uid&to=smartsms:*+001XXXXXX&msg="text of the message"&encoding=windows-1255
我想从PowerShell输入文本的详细信息,然后浏览此URL。我该怎么做?
I want to enter the details to the text from PowerShell and just surf to this URL. How can I do it?
推荐答案
在PowerShell v3中,看一下 Invoke-WebRequest 和 Invoke-RestMethod 例如:
In PowerShell v3, have a look at the Invoke-WebRequest and Invoke-RestMethod e.g.:
$msg = Read-Host -Prompt "Enter message"
$encmsg = [System.Web.HttpUtility]::UrlEncode($msg)
Invoke-WebRequest -Uri "http://smsserver/SNSManager/msgSend.jsp?uid&to=smartsms:*+001XXXXXX&msg=$encmsg&encoding=windows-1255"
这篇关于如何在PowerShell中使用HTTP GET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文