Invoke-WebRequest, POST with parameters

前端 未结 4 837
梦如初夏
梦如初夏 2020-11-29 16:43

I\'m attempting to POST to a uri, and send the parameter username=me

Invoke-WebRequest -Uri http://example.com/foobar -Method POST
4条回答
  •  無奈伤痛
    2020-11-29 17:01

    Put your parameters in a hash table and pass them like this:

    $postParams = @{username='me';moredata='qwerty'}
    Invoke-WebRequest -Uri http://example.com/foobar -Method POST -Body $postParams
    

提交回复
热议问题