lundi 28 mars 2016

failed login using powershell invoke-webrequest

Hoping someone can give me a few pointers on what is wrong with this code.

$url = "http://ift.tt/25sZP22"
$r = Invoke-WebRequest $url -SessionVariable Global:sess_var
$form = $r.Forms[0]
$form.Fields["username"] = "knownuser"
$form.Fields["pwd"] = "knownpass"
$uri = "http://ift.tt/22Vp1Mq"
$a=Invoke-WebRequest -Uri $uri -WebSession $sess_var -Method POST -Body $form.fields

Its getting an authentication error and I have tried everything and anything I could think of. The login.jsp comes back with two mandatory fields, which I am putting in the body. Any suggestions??




Aucun commentaire:

Enregistrer un commentaire