Difficulty (7-10)
I recommend you are intermediate in Visual Basic.
This tutorial will be using my VB.NET Wrapper found here.
The benefit of using a wrapper is the amount of lag it reduces compared to the webBrowser control.
With websites there are 2 kinds of requests a POST and a GET. POST will post information and the get will just simply go to a url.
Logging into Gaia uses a POST statement. To record this post statement you need to use FireFox and install the addon Live HTTP Headers.
Downloads.
After you are in FireFox head over to Log In | Gaia Online.Code:FireFox Live HTTP Headers
Now you need to hit tools and open Live HTTP Headers.
Make sure that "Capture" is checked.
Next use a valid Gaia account and login. Make sure that the Live HTTP Headers is open to log.
After you login you will see this.
Right click and copy the highlighted line in the picture.
It will be something like this.
Of coarse where username and password will be your test account.Code:token=279461850.1310153733.1533427493&sid=621b3d75ilkcrp2fcj5rkyv4zv6mqk4o&redirect=&username=Username&password=Password&chap=291259aee0173ea7162ad6c0c93f1abe
Heres how i learned to use the wrapper with gaia login.
Not let me explain this code part by part...Code:If Wrapper.post("http://www.gaiaonline.com/auth/login", "username=USERNAME&password=PASSWORD&token=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "token"" value=""", """") & "&chap=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "chap"" value=""", """"), "http://www.gaiaonline.com/").IndexOf("Logout") > -1 Then Label1.Text = "Logged in" Else Label1.Text = "Failed" End If
The bolded text is what is being POSTed to the server. Compare this to the statement you found using LiveHTTP Header.Code:Wrapper.post("http://www.gaiaonline.com/auth/login", "username=USERNAME&password=PASSWORD&token=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "token"" value=""", """") & "&chap=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "chap"" value=""", """")
Now there are two parts of this you should understand for future reference.
Now these two parts of the post statement are different every time and you are required to "catch" the new one every time. To catch these you need to use Wrapper.Between. The Between will look between characters to collect a value. So in "chap" for example.Code:"token"" value=""", """") & "&chap=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "chap"" value=""", """")
Wrapper.Between Accepts two arguments, in this case it is the GaiaLogin page and what you are looking for.Code:"token"" value=""", """") & "&chap=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "chap"" value=""", """")
Im sorry if that is not a thorough enough of, thats as far as i can think to go.
Now to make this work for your program, chose how you would like to collect the usernames and passwords to use in your program.
If you are going to use a console, declare 2 string name them something like "user","pass".
Using a textbox would look like this, i suggest to name the textboxs properly so it is not just "Textbox1".
Now add this code to a button click or what ever you want it to activate on.Code:If Wrapper.post("http://www.gaiaonline.com/auth/login", "username=USERNAME&password=PASSWORD&token=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "token"" value=""", """") & "&chap=" & Wrapper.Between(Wrapper.[Get]("http://www.gaiaonline.com/auth/login"), "chap"" value=""", """"), "http://www.gaiaonline.com/").IndexOf("Logout") > -1 Then Label1.Text = "Logged in" Else Label1.Text = "Failed" End If
I will post an example for download so you can see this in full use.
-Download-
Sorry if this got confusing.
Results 1 to 10 of 10
- 08 Jul. 2011 07:52pm #1
[VB.NET] [HTTPWrapper] Gaiaonline Login
Last edited by Shell; 08 Aug. 2011 at 12:56am.
- 08 Jul. 2011 08:45pm #2
I was about to say. Also Nice work. This is good for beginners in Vb.
- 07 Aug. 2011 10:47pm #3
- 07 Aug. 2011 11:39pm #4
- 07 Aug. 2011 11:50pm #5
- 08 Aug. 2011 12:57am #6
- 08 Aug. 2011 01:44am #7
- 26 Feb. 2012 01:19pm #8
- 27 Feb. 2012 03:15am #9
- 27 Feb. 2012 02:50pm #10