Sending POST Data via PowerShell

by Apr 29, 2010

Often, feedback or votes on Web pages are sent back via POST requests. You can send this kind of information via PowerShell as well. You should simply create a POST request with the target URL and the desired parameters/information and send it off:

$url = "http://someurl"
$parameters = "vote=true&poll_id=2" # your POST parameters

$http_request = New-Object -ComObject Msxml2.XMLHTTP
$'POST', $url, $false)
$http_request.setRequestHeader("Content-length", $parameters.length)
$http_request.setRequestHeader("Connection", "close")

Twitter This Tip! ReTweet this Tip!