New to powershell 4.0 and trying to figure out web-requests.
Simply trying to logon to facebook with the below code:
$azr = Invoke-WebRequest -uri "https://www.facebook.com/" -SessionVariable sbv
$azr|gm
$azr.Forms
$db_Form = $azr.Forms[0]
$db_Form
$db_Form.Fields
$db_Form.Fields["email"]="LoginEmail@gmail.com"
$db_Form.Fields["pass"]="Username"
$db_Form.Action
$r = Invoke-WebRequest -Uri ("https://www.facebook.com/"+$db_Form.Action) -WebSession $sbv -Method Post -Body $db_Form.Fields
But I keep getting an error, telling me
Invoke-WebRequest : The request was aborted: The connection was closed unexpectedly.
And directs the error to the last line of code. Any clues as to why this is?