Post Method

Welcome Forums General PowerShell Q&A Post Method

Viewing 1 reply thread
  • Author
    Posts
    • #109835
      Participant
      Topics: 12
      Replies: 9
      Points: 35
      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
      Topics: 18
      Replies: 4872
      Points: 1,903
      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

Viewing 1 reply thread
  • The topic ‘Post Method’ is closed to new replies.