Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Aug 11, 2020 11:13 pm

All times are UTC - 5 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: HTTPSocket WebSite Login
PostPosted: Wed Jul 06, 2011 9:47 am 
User avatar

Joined: Sat May 27, 2006 3:27 pm
Posts: 480
Hello i was wondering i have a vary simple code in VB6 that logs into a website. I tryed the same in RB but it does not log into the webpage. Am i doing something wrong here?

Private Sub Command1_Click()
WebBrowser1.Document.All("login_email").Value = Email.Text
WebBrowser1.Document.All("login_pass").Value = Password.Text
End Sub

Private Sub Form_Load()
WebBrowser1.Silent = True
WebBrowser1.Navigate ("")
End Sub


Dim form As Dictionary
Dim Cookies , Data As String
Dim i As Integer
form = New Dictionary

form.value("login_pass") = Password.Text

HTTPSocket1.SetFormData( form )
HTTPSocket1.Post( "" )

For i = 0 To HTTPSocket1.pageHeaders.nameCount("set-cookie")-1
Cookies = Cookies + HTTPSocket1.PageHeaders.Value( i ) + "; "

HTTPSocket1.SetRequestHeader( "Cookie", Cookies )

Reply with quote  
 Post subject: Re: HTTPSocket WebSite Login
PostPosted: Wed Jul 06, 2011 12:30 pm 

Joined: Thu Dec 16, 2010 1:22 pm
Posts: 188
are you getting an error of some kind? I always recommend firing up wireshark and see what's going on behind the scenes in cases like this. Maybe an encoding problem or a hidden field that needs to be set.

it is standard http authentication? or a form on a page?
for standard http authentication see this discussion

otherwise for a form, your procedure seems to be correct provided you are returning all the necessary fields/cookies that the site is expecting.

one thing I do notice though that might be causing a problem, you should capture your pageheaders in the HeadersReceived event. The way you have it coded, it just flies through the "" and continues before the page is even delivered, so it probably is skipping right over your for-loop. Remember that httpsockets are asynchronous so you have to wait for results before you proceed.
Good luck

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group