Post Method

Welcome Forums General PowerShell Q&A Post Method

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

 
Keymaster
3 months, 2 weeks ago.

  • Author
    Posts
  • #109835

    Participant
    Points: 3
    Rank: Member

    Hi everyone. I want invoke this webseite then pass query

    http://www.overpass-api.de/query_form.html

    $test =  Invoke-WebRequest -Uri "http://www.overpass-api.de/query_form"

    $dbForm = $test.Forms[0]
    $dbForm

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

    $dbForm.Fields

    $r = Invoke-WebRequest -Uri ("http://www.overpass-api.de/"  -$dbForm.Action) -Method Post -Body $dbForm.Fields

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

    Any tips will make me glad.

    Thanks

  • #110777

    Keymaster
    Points: 1,704
    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.