2014年2月7日 星期五

如何透過PowerShell送出http request?

TechNet: http://technet.microsoft.com/en-us/library/hh849971.aspx 

在PowerShell 3.0以後,多個 Invoke-RestMethod 可以用來送出 HTTP or HTTPS request, 而且可以支援 RESTful web service.
簡單介紹一下,要怎麼送出一個單純的http reqeust (GET):
PS C:\> Invoke-RestMethod google.com.tw

就可以得到網站回應的結果了,真方便。