Unable to log in to webpage using XMLHTTP - vba

i am trying to login to webpage and download data but unable to get in, its secured site & require pwd. i tried thru post methd but no luck, plz help me where i am going wrong..
Sub Go_New_XML()
Dim oHttp As Object. sHTML as String
Set oHttp = CreateObject("MSXML2.XMLHTTP")
oHttp.Open "POST", "http://www.example.com/login.asp", False
oHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
oHttp.send "username=aa#gmail.com&login-password=passss"
While oHttp.readyState <> 4
DoEvents
Wend
sHTML = oHttp.responseText
Debug.Print sHTML
End Sub

If one has to achieve something like this, he has to look into the source of the Login HTML. In this case it shows:
<form name="FrontPage_Form1" action="user_login.asp" method="post" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" id="login-form">
<fieldset>
<p><label for="login-username">username</label>
<input id="login-username" autofocus="" class="round full-width-input" name="username" size="32" value="" type="text">
</p><br>
<p><label for="login-password">password</label>
<input id="login-password" class="round full-width-input" name="password" size="32" value="" type="password">
</p><br>
<p>
<input value="1" name="remember" =""="" type="checkbox">Remember Me</p><br>
<input name="redirect" value="http://stackoverflow.com/questions/25782351/unable-to-log-in-to-webpage-using-xmlhttp" type="hidden">
<p>I've forgotten my password.</p>
<br><br>
<input name="submit" value="Login" class="button round blue image-right ic-right-arrow" type="submit">
or
<a href="user_signup.asp" class="button round blue image-right ic-right-arrow">
REGISTER NOW</a> </fieldset>
</form>
So there are following elements in submit POST:
username with the username as value
password with the password as value
redirect with a URL as value
submit with "Login" as value
Note, that this are the names of the form elements.
The checkbox "remember" is not per default in the submit, because it is a checkbox and gets only submitted, if it is checked.
Maybe the site only accepts logins which has all default elements in POST. If so then try:
oHttp.send "username=aa#gmail.com&password=passss&redirect=http%3A%2F%2Fwww.example.com&submit=Login"
Note that the URL in redirect has to be URL encoded as needed for the type application/x-www-form-urlencoded.
Also maybe the site tries to prevent automated logins. You should respect that then.
Greetings
Axel

Related

How to stay on the same page after a form submission integrated to a Google form

In my website i have a contact form, and i've integrated it with a Google form. I've added the google form's execute URL as the action URL so once its submitted the form is being populated with the form data. the way i have done it
But when its being submitted, its redirecting to a google form's response page. What i need is once its submitted, to stay on the same page and give an alert. Im not sure how to do this in vue js. Any suggestion will be appreciated.
the content on the redirected page
{"result":"success","data":"{\"name\":[\"sdvsdv\"],\"company\":[\"dsvdv\"]}"}
Form in vue js view
<form method="POST" id="appointment-form" action="https://script.google.com/macros/s/AKfycbzRHvjfmIZdwKnOm26PeFv64OyyyGAfcr68MxvYw/exec">
<div class="form-group">
<input type="text" placeholder="Your name" name="name" class="form-control" id="name" required>
</div>
<div class="form-group">
<input type="text" placeholder="Company name" name="company" class="form-control" id="company" required>
</div>
<buttontype="submit" class="btn btn-default btn-block form-submit-btn">Submit</button>
</form>
After read your code properly, i found many errors.
How are you saving input values?
To save, you have to use ```v-model directive````
I guess you save the input values in somewhere. To avoid your problem, you can add a method and call it on submit, and inside the method save your input values.

VB webbrowser click on html submit form without id

I want to do login to the site http://seafight.com.
This is code of login on the site
</div>
<fieldset class="bgcdw_login_form_login"><div class="bgcdw_input_text bgcdw_login_form_username">
<label for="bgcdw_login_form_username">Nazwa</label>
<input id="bgcdw_login_form_username" name="username" type="text" maxlength="20"></div>
<div class="bgcdw_input_password bgcdw_login_form_password">
<label for="bgcdw_login_form_password">Hasło</label>
<input id="bgcdw_login_form_password" name="password" type="password" maxlength="45"></div>
</div>
<fieldset class="bgcdw_login_form_buttons"><input class="bgcdw_button bgcdw_login_form_login" type="submit" value="Logowanie">
</div>
And this is a piece of code in my app
WebBrowser1.Navigate("http://seafight.com")
WriteLog("Loading Seafight page...")
While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While
WebBrowser1.Document.GetElementById("username").InnerText = LoginBox.Text
WebBrowser1.Document.GetElementById("password").InnerText = PasswordBox.Text
and I don't know how to click submit button because it doesn't have ID. Any ideas?
I tried
WebBrowser1.Document.GetElementById("submitButton").InvokeMember("click")
and
WebBrowser1.Document.GetElementsByTagName("button, submit etc")
(0 counts with this tag names)

Fastlink Landing page is not getting rendered

I am working on implementing Fastlink 2.0 integration for aggregation and IAV for my application. I am able to get the oauth token for both Aggregation and IAV but when I am using it along with the required parameters to render the Fastlink landing page I am getting the response as Cannot get resource.
The steps I followed are as below:
Logged in with Cobrand username and password and got the cobrandSessionToken (e.g. 08062013_0:26fe011eff898dc0babb8b54fad90ac522e753c6e4d29b7329eeb67e57b760975a9918d8a913c83a910199e6f1b9dd15652532011100010328dad2e6b29f49b3).
Using the demo username/password got the userSessionToken (e.g. 08062013_0:d1958fca493a02fadcad93019ba44bd3563cc4cb437331c60b3df77a4e353ed2137ba641c879a6736a112d613a146438f45fc8a5f5540ffb65ec17dee42fee46 )
Using the cobrandSession token, rsession(userSession) token and 10003600 (aggregation) as finappId got the oauth token.
Using the token generated in Step 3, rsession(userSession) token generated in Step 2 and app (i.e., finappId) invoke the Yodlee Fastlink using the following url.
https://node.developer.yodlee.com/authenticate/restserver
Complete url:
https://node.developer.yodlee.com/authenticate/restserver?app%3D10003600%26rsession%3D08062013_0%3A03cfae2bd46624e71b1306cbe9730a8f92085c28657f271f9fa84bf17ccf566428be4da399c2a995e95d1c5527442735398a49d96007826b3a2af118d7b53dc1%26token%3Db3298792d5a43473fa2434ae9c6453dffd74392b4ae0608a75b40922ca3d5325%26redirectReq%3Dtrue%26extraParams%3D
Kindly help if somebody knows how to resolve this
Thanks
You need to submit this as an HTML Form post, this is not a REST GET request. This means it will not work if you just append it to the URL and try to get it.
Here is the HTML Form you can replace the respective values-
<div class='center processText'>Processing...</div><div>
<form action='<nodeURL>' method='post' id='rsessionPost'>
RSession : <input type='text' name='rsession' placeholder='rsession' value='06142015_0:9d2817f2164ef0720282fd680c882b188b776d93e4af03155b0508a09ae8e274f0caab5d2d6819bee2ec69c85044410acb356807ba69ecd3e6e28643120dab61' id='rsession'/><br/>
FinappId : <input type='text' name='app' placeholder='FinappId' value='10003620' id='finappId'/><br/>
Redirect : <input type='text' name='redirectReq' placeholder='true/false' value='true'/><br/>
Token : <input type='text' name='token' placeholder='token' value='6ea1ef4aaa1ec923aba38b911a45cbe0019a387837b0a83738ec40a8c9a24613' id='token'/><br/>
Extra Params : <input type='text' name='extraParams' placeholer='Extra Params' value='' id='extraParams'/><br/></form></div>
<script>document.getElementById('rsessionPost').submit();</script>
As advised by Apoorv, this can only be done through HTML form post. If you set redirectReq as FALSE and do a HTTP Post you will get the FinAppURL, but the url will never work. If you need to display fastLink 2.0 inside iframe you can can achieve it by setting the form target to the iframe as shown below.
<div style="visibility: hidden">
<form action="https://auyirestnode.stage.yodleeinteractive.com/authenticate/private-ausandbox16/?channelAppName=auyirestmaster" method="post" name="rsessionPost" id="rsessionPost" target="yodleeIframe">
<input style="visibility: hidden" type="text" name="rsession" placeholder="rsession" value="#Model.RSession" id="rsession" /><br />
<input style="visibility: hidden" type="text" name="app" placeholder="FinappId" value="10003600" id="finappId" /><br />
<input style="visibility: hidden" type="text" name="redirectReq" placeholder="true/false" value="true" /><br />
<input style="visibility: hidden" type="text" name="token" placeholder="token" value="#Model.Token" id="token" /><br />
<input style="visibility: hidden" type="text" name="extraParams" placeholer="Extra Params" value="#Model.ExtraParams" id="extraParams"/>
</form>

Does Lotus Domino 9.0.x still support REQUEST_CONTENT_nnn fields?

In my form design element, say "form1", for some reason, I need to disable its original form behavior and implement another form. So I used </form> at the beginning of the "form1" marked with pass-thru. And then I put some pass-thru http lines like below under </form>:
<form name="simple" method="post" enctype="multipart/form-data" action="test?openagent">
<label for="username">Your Name</label>
<input type="text" name="username" /><br />
<label for="email">Your Email</label>
<input type="text" name="email" /><br />
<label for="fileuploader">attachment</label>
<input type="file" name="fileuploader" />
<input type="submit" value="Sign Up!" />
</form>
The codes in agent "test" were mainly as below:
Dim s As New NotesSession
Dim doc As NotesDocument
Set doc = s.Documentcontext
If doc.Hasitem("REQUEST_CONTENT") Then
MsgBox "REQUEST_CONTENT=" & doc.REQUEST_CONTENT(0)
Else
If doc.Hasitem("REQUEST_CONTENT_000") Then
MsgBox "REQUEST_CONTENT_000=" & doc.REQUEST_CONTENT_000(0)
End If
End If
ForAll i In doc.Items
MsgBox i.name & "=" & i.values(0)
End ForAll
After I filled the username, email, and picked an attachment, and then submitted the form, I found there was neither "REQUEST_CONTENT" nor "REQUEST_CONTENT_000" item shown; but there was CONTENT_LENGTH item shown and of value 130520.
My question is, in Domino 9.0.x, what item(s) contain(s) the post data?
None. Simple but sad:
Notes just allows natively via Notes inserted File Upload Controls.
Lotusscript has never been able to handle POSTed binaries.
You should use a Form to accomplish that.

jquery-ui dialog password already filled at open

As wanted, dialog box for login is opened, but password is already filled in, although I put password field with value=""
<div id="dialog" title="Connexion aux données">
<form>
<fieldset class="ui-helper-reset">
<br>
<div>Nom du foyer</div>
<input type="text" name="foyer" id="foyer" value="" class="ui-widget-content ui-corner-all"><br>
<div>Mot de passe</div>
<input type="password" name="password" id="password" value="" class="ui-widget-content ui-corner-all"><br>
<div style="font-size:0.6em;padding-top:6px;">Afficher les caractères</div>
<input type="checkbox" name="reveal" id="reveal" value="" class="ui-widget-content ui-corner-all" style="width:20px;">
</fieldset>
</form>
</div>
and Jquery code in head part
var $dialog = $( "#dialog" )
.dialog({
autoOpen: false,
modal: true,
resizable: false,
draggable: false,
close: function(event,ui) {
$(this).find('form')[0].reset();
}
});
$dialog.dialog('open');
I have also cleaned browser cache but nothing changed.
By clicking on reveal checkbox I saw password is the same I have used in previous dev for testing few months ago.
Why this happens and how to avoid it ?
This happened for me too. After debugging I found out that it was the password that browser had saved and it was loading it onto the password field on page load.
After clearing the saved password, I was able to get the empty password textbox.
This could be the case with you too.