Invoke-webRequest help

Welcome Forums General PowerShell Q&A Invoke-webRequest help

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
2 years, 1 month ago.

  • Author
    Posts
  • #54977

    Participant
    Points: 0
    Rank: Member

    Hi. I am trying to understand Invoke-webRequest and how to submit information properly. Issue: Current site will not allow user authentication and a checkbox needs to be selected to allow advancing to the next page. Using fiddler I have discovered the only difference when clicking the checkbox appears to add one extra value. After Invoke-Webrequest to my $uri variable, I can see that $data.forms.fields has this field and the value set to ON. I then proceed to invoke-webrequest to the same $uri using the following

    $Returndata= Invoke-WebRequest $Uri -Credential $cred -Method Post -Body $data.Forms.fields -ContentType "application/x-www-form-urlencoded"

    My $returnData is always the same as my original data. I am hoping it would return the next page so I can submit the necessary data into the next page that has more form data. Looking for any advice if this can be done.

  • #54980

    Participant
    Points: 159
    Helping Hand
    Rank: Participant

    I would recommend using a tool built to interface with API's like PostMan, which is a Chrome extension. I'd review the API documentation to see if there are examples on how to do what you're attempting. It really depends on how the API is built to help you with your inquiry.

The topic ‘Invoke-webRequest help’ is closed to new replies.