PowerShell v3 Invoke-WebRequest: Troubles with forms

前端 未结 4 446
花落未央
花落未央 2021-01-04 04:38

Since I upgraded to Windows 8 a lot of my PowerShell scripts relying on launching an invisible IE won’t quite work anymore, so I tried switching to the Invoke-WebRequest

4条回答
  •  太阳男子
    2021-01-04 05:18

    Try doing the post directly e.g.:

    $formFields = @{username='john doe';password='123'}
    Invoke-WebRequest -Uri $myUrl -Method Post -Body $formFields -ContentType "application/x-www-form-urlencoded"
    

提交回复
热议问题