powershell - Invoke-WebRequst to login web site -
i want use command line tool login site http://url/login.html page not have form have 3 input fields
<div class="login-form"> <div class="phone-number"> <input id="account" type="text" placeholder="account" /> </div> <div class="code-input" style="position: relative;"> <input id="acc_pass" type="password" placeholder="password" style="height:35px;" /> </div> <p id="js_acc_error" style="color:red;margin-top:10px;"></p> <div class="login-other"> <input id="account_login_checkbox" type="checkbox" /> <span>read , agree<a class="show-xieyi" style="color:#3a74ba;cursor:pointer;"> eul </a></span> </div> <div style="display:none; margin:4px 0 0 0;"> </div> <div class="login-btn" style="margin:10px 0 0"> <button id="account_login_btn" type="submit">login</button> </div> </div> i used fiddler capture request after click submit button , replay request use curl not work because cookies changed.
so want use command fill input fields , click button replay request.how can fill fields , click button in powershell invoke-webrequest or other command line tools?
thanks.
when click login button, send http request address post method. in powershell can this:
curl 'https://site/longin.html' -body "account=john&acc_pass=1234&account_login_checkbox=false" -method post you might have tweak little bit, should work. way curl alias powershell's invoke-webrequest.
Comments
Post a Comment