Problem - WeOnlyDo Discussion board

Problem (wodHttpDLX)

by celtik, Saturday, November 22, 2008, 17:34 (5846 days ago)

OK, I coded a program to check an account. When I made a project with only two textboxes and a command button with the following code it works:
[code]
HTTP.Disconnect
HTTP.URL = http://xxxx
HTTP.Request.FormPost.Add _VIEWSTATE , 2FwEPDwUJNTU4OTgyNDc1ZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAQUnY3RsMDAkY3BNYWluJExvZ2luQm94JFJlbWVtYmVyX0NoZWNrYm94
HTTP.Request.FormPost.Add NextPage ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$Email_Textbox , Text1.Text
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$Password_Textbox , Text2.Text
HTTP.Request.FormPost.Add dlb , Log In
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$SingleSignOnHash ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$SingleSignOnRequestUri ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$nexturl ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$apikey ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$ContainerPage ,
HTTP.Post

Private Sub HTTP_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)
Dim oldcookie As HttpCookie
For Each oldcookie In HTTP.Response.Cookies
HTTP.Request.Cookies.Add oldcookie.Name, oldcookie.Value
Next
If ErrorCode = 0 Then
HTTP.Disconnect
RichTextBox1.Text = HTTP.Response.Body
If InStr(1, RichTextBox1.Text, Skip this Advertisement ) Then
Label1.Caption = home
HTTP.URL = http://xxx
HTTP.Get
RichTextBox1.Text = HTTP.Response.Body
End If
If InStr(1, RichTextBox1.Text, My Friend Space ) Then
Label1.Caption = VALID
End If
If InStr(1, RichTextBox1.Text, Please log in to continue ) Then
Label1.Caption = INVALID
End If
Else
RichTextBox1.Text = ErrorText
End If
End Sub
[/code]

I will post the next part of code in the next post to save room

Re: Problem

by celtik, Saturday, November 22, 2008, 17:36 (5846 days ago) @ celtik

Now, I have another project that uses listboxes so that it will go through the list checking each..Here is the code:

[code]
Dim strsplit() As String
Dim usernames(999) As String
Dim passwords(999) As String
Dim i As Integer

Command7.Enabled = True
blnGo = True

For i = 0 To List1.ListCount - 1
If blnGo = True Then

List1.ListIndex = i

If InStr(1, List1.Text, : ) = 0 Then
strsplit(0) =
strsplit(1) =
Label4.Caption = Bad Login!
Else
strsplit() = Split(List1.List(i), : )
usernames(i) = strsplit(0)
passwords(i) = strsplit(1)
End If

HTTP.URL = http://xxx
HTTP.Request.FormPost.Add _VIEWSTATE , 2FwEPDwUJNTU4OTgyNDc1ZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAQUnY3RsMDAkY3BNYWluJExvZ2luQm94JFJlbWVtYmVyX0NoZWNrYm94
HTTP.Request.FormPost.Add NextPage ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$Email_Textbox , strsplit(0)
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$Password_Textbox , strsplit(1)
HTTP.Request.FormPost.Add dlb , Log In
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$SingleSignOnHash ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$SingleSignOnRequestUri ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$nexturl ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$apikey ,
HTTP.Request.FormPost.Add ctl00$cpMain$LoginBox$ContainerPage ,
HTTP.Post

If List1.ListCount - 1 = List1.ListIndex Then
Label4.Caption = Done!
End If
End If
Next i

Private Sub HTTP_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)
Dim oldcookie As HttpCookie
For Each oldcookie In HTTP.Response.cookies
HTTP.Request.cookies.Add oldcookie.Name, oldcookie.Value
Next

If ErrorCode = 0 Then
HTTP.Disconnect
RichTextBox1.Text = HTTP.Response.Body
If InStr(1, RichTextBox1.Text, Skip this Advertisement ) Then
Label1.Caption = home
HTTP.Get http://xxxx
RichTextBox1.Text = HTTP.Response.Body
End If
If InStr(1, RichTextBox1.Text, My Friend Space ) Then
Label4.Caption = VALID
End If
If InStr(1, RichTextBox1.Text, Please log in to continue ) Then
Label4.Caption = INVALID
End If
Else
RichTextBox1.Text = ErrorText
End If
End Sub
[/code]

For some reason it says every account is invalid, which I do not understand.

Re: Problem

by woddrazen, Saturday, November 22, 2008, 20:02 (5846 days ago) @ celtik

Celtik,


This obviously is issue with your code because if it works with textbox it must work with listbox. Most probably you didn't pass some data correctly from listbox to wodHttpDLX code.

Also if you are doing this in some loop. Connecting new user over and over again. Maybe you should reload wodHttpDLX reference.

----------------------
Set http1 = Nothing

and then

Set http1 = new wodHttpDLXCom
----------------------

So you can be sure that all data is clear before next request with server.


Drazen

Re: Problem

by celtik, Sunday, November 23, 2008, 03:09 (5846 days ago) @ woddrazen

Alright, thanks for your help. I figured it is a problem with my code, just wanted to see if there was some easy solution. Thanks