Aquí el código:
Citar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim postData As String = "loginForm_default_username=" & TextBox1.Text & "&loginForm_default_password=" & TextBox2.Text & "&loginForm_default_login_submit=Entrar"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.darkorbit.com/?locale=mx&aid=0&aip="), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "http://www.darkorbit.com/?locale=mx&aid=0&aip="
postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
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())
'Seleccionar Servidor
Dim getData As String = "GameAPI.php?req=YTo1OntzOjY6ImFjdGlvbiI7czoyMToicG9ydGFsLmxvZ2luQnlDcnlwdElkIjtzOjEyOiJsb2dpbkNyeXB0SWQiO3M6MzI6Ijc0NTU2YjFjODJkYmQxMzgzNjMzNGQyMmUxZWNkMmE0IjtzOjY6ImdhbWVJZCI7aTo4OTtzOjY6ImxvY2FsZSI7czoyOiJteCI7czo5OiJib251c0NvZGUiO047fQ%3D%3D&sign=7ceb6231a1d8063f5079b12c44594ae9&lang=mx&ref_sid=25bcc10fa4fc11ac3daaff6e999ee804&ref_pid=22&__utma=1.252823780.1343403563.1343493603.1343507477.7&__utmb=1.6.10.1343507477&__utmc=1&__utmx=-&__utmz=1.1343403563.1.1.utmcsr%3D%28direct%29%7Cutmccn%3D%28direct%29%7Cutmcmd%3D%28none%29&__utmv=-&__utmk=260647309 HTTP/1.1"
Dim getrequest As HttpWebRequest = HttpWebRequest.Create("http://es1.darkorbit.bigpoint.com/")
Dim ascii As New UTF8Encoding
Dim getbyte As Byte() = ascii.GetBytes(getData)
getrequest.Method = "post"
getrequest.KeepAlive = True
getrequest.ContentLength = getbyte.Length
getrequest.ContentType = "application/x-www-form-urlencoded"
getrequest.CookieContainer = tempCookies
getrequest.ContentType = "application/x-www-form-urlencoded"
getrequest.Referer = "http://www.darkorbit.com/?locale=mx&aid=0&aip="
getrequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
postresponse = DirectCast(getrequest.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
logincookie = tempCookies
'Pagina Web
Dim thepage As String = postreqreader.ReadToEnd
Form2.WebBrowser1.DocumentText = thepage
End Sub
Dim postData As String = "loginForm_default_username=" & TextBox1.Text & "&loginForm_default_password=" & TextBox2.Text & "&loginForm_default_login_submit=Entrar"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://www.darkorbit.com/?locale=mx&aid=0&aip="), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "http://www.darkorbit.com/?locale=mx&aid=0&aip="
postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
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())
'Seleccionar Servidor
Dim getData As String = "GameAPI.php?req=YTo1OntzOjY6ImFjdGlvbiI7czoyMToicG9ydGFsLmxvZ2luQnlDcnlwdElkIjtzOjEyOiJsb2dpbkNyeXB0SWQiO3M6MzI6Ijc0NTU2YjFjODJkYmQxMzgzNjMzNGQyMmUxZWNkMmE0IjtzOjY6ImdhbWVJZCI7aTo4OTtzOjY6ImxvY2FsZSI7czoyOiJteCI7czo5OiJib251c0NvZGUiO047fQ%3D%3D&sign=7ceb6231a1d8063f5079b12c44594ae9&lang=mx&ref_sid=25bcc10fa4fc11ac3daaff6e999ee804&ref_pid=22&__utma=1.252823780.1343403563.1343493603.1343507477.7&__utmb=1.6.10.1343507477&__utmc=1&__utmx=-&__utmz=1.1343403563.1.1.utmcsr%3D%28direct%29%7Cutmccn%3D%28direct%29%7Cutmcmd%3D%28none%29&__utmv=-&__utmk=260647309 HTTP/1.1"
Dim getrequest As HttpWebRequest = HttpWebRequest.Create("http://es1.darkorbit.bigpoint.com/")
Dim ascii As New UTF8Encoding
Dim getbyte As Byte() = ascii.GetBytes(getData)
getrequest.Method = "post"
getrequest.KeepAlive = True
getrequest.ContentLength = getbyte.Length
getrequest.ContentType = "application/x-www-form-urlencoded"
getrequest.CookieContainer = tempCookies
getrequest.ContentType = "application/x-www-form-urlencoded"
getrequest.Referer = "http://www.darkorbit.com/?locale=mx&aid=0&aip="
getrequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
postresponse = DirectCast(getrequest.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
logincookie = tempCookies
'Pagina Web
Dim thepage As String = postreqreader.ReadToEnd
Form2.WebBrowser1.DocumentText = thepage
End Sub
Ya comprobé que para seleccionar el servidor, se puede hacer un envió mediante el método GET para que abra la pagina del juego (Estoy tratando de hacer un Bot) De antemano gracias por la ayuda, si me pudieran recomendar formas de hacer que el programa interactue con un servidor de esta clase de videojuegos (Navegador) las investigare.
PD: Llevo varias noches intentando varias formas de que entre al servidor, pero todos son intentos fallidos
Salu2