I wrote this code a few hours ago, Very Simple, an Very easy for people that know VB.NET.
Code:Imports System.Net Imports System.Web Imports System.IO Public Function Login(ByVal Username As String, _ ByVal Password As String) As Boolean Dim strToken As String, strSID As String, strRedirect As String Dim PageSource As String = String.Empty Dim CC As CookieContainer = New CookieContainer() Dim Request As HttpWebRequest = HttpWebRequest.Create("http://www.gaiaonline.com/auth") Request.Method = WebRequestMethods.Http.Get Request.KeepAlive = True Request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 4.0.20506)" Request.CookieContainer = CC Dim Response As HttpWebResponse = Request.GetResponse() Dim Stream As New StreamReader(Response.GetResponseStream()) PageSource = Stream.ReadToEnd() Response.Close() PageSource = Replace(PageSource, """", "'") strToken = GetStringBetween(PageSource, "<input type='hidden' name='token' value='", "' />") strSID = GetStringBetween(PageSource, "<input type='hidden' name='sid' value='", "' />") strRedirect = GetStringBetween(PageSource, "<input type='hidden' name='redirect' value='", "' />") Dim strPostData As String = "token=" & _ strToken & "&sid=" & _ strSID & "&redirect=" & _ System.Web.HttpUtility.UrlEncode(strRedirect) & "&username=" & _ System.Web.HttpUtility.UrlEncode(Username) & "&password=" & _ Password & "&chap=" Request = HttpWebRequest.Create("http://www.gaiaonline.com/auth/login/") Request.Referer = "http://www.gaiaonline.com/auth" Request.KeepAlive = True Request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 4.0.20506)" Request.CookieContainer = CC Request.Method = WebRequestMethods.Http.Post Request.ContentType = "application/x-www-form-urlencoded" Request.ContentLength = strPostData.Length Dim writer As New StreamWriter(Request.GetRequestStream) writer.Write(strPostData) writer.Close() Response = Request.GetResponse() Dim reader As New StreamReader(Response.GetResponseStream()) PageSource = reader.ReadToEnd() Response.Close() If (InStr(1, PageSource, "<title>Welcome to Gaia | Gaia Online</title>", CompareMethod.Text) <> 0) Then Login = True Else Login = False End If End Function
Results 1 to 12 of 12
- 03 Apr. 2010 07:17am #1
[VB.NET]Gaia Login(HttpWebRequest+HttpWebResponse)
- 03 Apr. 2010 02:38pm #2
Very nice Blazer... Its simple and effective.
Although most people prefer to use HTTP Wrappers.Shh, I'm watching My little pony.
- 03 Apr. 2010 04:02pm #3
- 03 Apr. 2010 04:09pm #4
Ahh, I didnt see this
Thanks for telling me.Shh, I'm watching My little pony.
- 02 Aug. 2010 03:12pm #5
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
Works great, used it in my shitty public program and currently using it in my Arena voter.
E: If you're still active, think you could make a logout function?Last edited by TEMPTii; 02 Aug. 2010 at 03:14pm.
- 04 Aug. 2010 05:29pm #6
- 04 Aug. 2010 07:33pm #7
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
To use the function for the login, it's:
Code:If Login(txtUsername, txtPassword) = True then msgbox("Logged in!") Elseif Login(txtUsername, txtPassword) = False then msgbox("Login Failed!") End if
- 05 Aug. 2010 08:45am #8
- 05 Aug. 2010 11:08am #9
Awesome. saves me time. ;P +1 for the time saver1111!
- 05 Aug. 2010 05:00pm #10
- 05 Aug. 2010 06:06pm #11
- 05 Aug. 2010 11:25pm #12
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
Making a wrapper is simply making a class and turning this into functions. I'll do it