Post Method

Hi everyone. I want invoke this webseite then pass query

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

$test = Invoke-WebRequest -Uri “Overpass API 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

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