Posted 12 years ago
·
Author
This is the code that will allow you to login to imvu with your program and store the data in a cookie. This is useful if you want to use the Imvu api in your programs or access ap/vip data.
All you need to do after putting the above code in your program somewhere is declare the global logincookie variable at the top of your class like so:
Then set your codes cookie container to the logincookie and your code will have whatever data you store from logging in (Ap/vip access for example).
Dim postData As String = "POSTDATA=sauce=&avatarname=" & avibx.Text & "&" & "password=" & passbx.Text & "&password_strength=strong&sendto="
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://secure.imvu.com/login/login/"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "http://www.imvu.com/login/"
postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1"
postReq.ContentLength = byteData.Length
Dim postreqstream As Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
logincookie = tempCookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
''This is for debugging / checking for a successful login
Dim thepage As String = postreqreader.ReadToEnd
Debugbx.Text = thepage
If Debugbx.Text.Contains("<title>My IMVU</title>") Then
MsgBox("Success")
End If
''End Dubug / Check Code
All you need to do after putting the above code in your program somewhere is declare the global logincookie variable at the top of your class like so:
Then set your codes cookie container to the logincookie and your code will have whatever data you store from logging in (Ap/vip access for example).