Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Oct 13, 2019 7:36 pm
xojo

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 
Offline
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?

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

Private Sub Form_Load()
WebBrowser1.Silent = True
WebBrowser1.Navigate ("http://www.mediafire.com/")
End Sub


RB

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

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

HTTPSocket1.SetFormData( form )
HTTPSocket1.Post( "http://www.mediafire.com/" )

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

HTTPSocket1.SetRequestHeader( "Cookie", Cookies )


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

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
http://forums.realsoftware.com/viewtopic.php?f=1&t=38186&start=0

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 "httpsocket1.post" 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


Top
 Profile  
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