Trying to automate some posting to the web that we do but running into either weirdness with invoking-webrequest -Body $postparams or I'm not doing it right.
The default fields when that page is requested are: S_Period_Str = "", E_Period_Str = "11/04/15", input-option = "checked"
I have -
When I do this, the response is
S_Period_Str "11/03/15"
E_Period_Str "?"
input-option "checked"
So it seems to be posting one of the values and changing another. I don't see any misspellings, no idea why it's not posting the rest.
I can get around it by doing that invoke method then
That seems to post everything correctly but there has to be a reason why the initial post isn't working.
I'm not good with the web request/response/post/get/etcetc things
The default fields when that page is requested are: S_Period_Str = "", E_Period_Str = "11/04/15", input-option = "checked"
I have -
Code:
$postParams = @{S_Period_Str='11/03/15';E_Period_Str='11/03/15';'input-option'='checkedOther'}
$r = Invoke-WebRequest $site -Method POST -Body $postParams -Credentials $creds
S_Period_Str "11/03/15"
E_Period_Str "?"
input-option "checked"
So it seems to be posting one of the values and changing another. I don't see any misspellings, no idea why it's not posting the rest.
I can get around it by doing that invoke method then
Code:
$r.Forms[0].Fields.S_Period_Str = "11/03/15"
$r.Forms[0].Fields.E_Period_Str = "11/03/15"
$r.Forms[0].Fields."input-options" = "checkedOther"
Invoke-RestMethod $site -Method POST -Body $r -Credential $cred
I'm not good with the web request/response/post/get/etcetc things
Last edited: