Post Method

Welcome Forums General PowerShell Q&A Post Method

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

9 months, 2 weeks ago.

  • Author
  • #109835

    Topics: 10
    Replies: 7
    Points: 5
    Rank: Member

    Hi everyone. I want invoke this webseite then pass query

    $test =  Invoke-WebRequest -Uri ""

    $dbForm = $test.Forms[0]

    $dbForm.Fields[""] =   "[bbox:50.662127,5.9748990,50.857233,6.218150];node [natural = tree];out meta;"


    $r = Invoke-WebRequest -Uri (""  -$dbForm.Action) -Method Post -Body $dbForm.Fields

    and i write this code but it didn't work well.

    Any tips will make me glad.


  • #110777

    Topics: 13
    Replies: 4872
    Points: 1,812
    Helping HandTeam Member
    Rank: Community Hero

    That's unfortunately not how HTTP passes forms; they get passed in the request header. You don't really need to retrieve the page first, even; you just need to submit a properly formatted request with the form data in the header. It's not HARD to do with PowerShell, but it's not super easy, either. And, some servers may – for security reasons – implement additional items, such as cookies, which will make it more complex. You'll need to understand exactly what the web server expects n

The topic ‘Post Method’ is closed to new replies.