[vb.net] Good or not

07/05/2012 19:02 ЙōČhěάŧĪмPĞM-hacked#1
Something better?

Code:
Imports System.Net
Imports System.Text
Imports System.IO

Public Class Form1

    Dim logincookie As CookieContainer

    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/"), HttpWebRequest)
        postReq.Method = "POST"
        postReq.KeepAlive = True
        postReq.CookieContainer = tempCookies
        postReq.ContentType = "application/x-www-form-urlencoded"
        postReq.Referer = "http://www.darkorbit.com/"

        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())

        Dim thepage As String = postreqreader.ReadToEnd

        RichTextBox1.Text = thepage
        WebBrowser1.DocumentText = RichTextBox1.Text
    End Sub


    Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
        WebBrowser1.DocumentText = RichTextBox1.Text
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
        WebBrowser1.ScriptErrorsSuppressed = True
    End Sub

    Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
        
    End Sub
End Class
07/05/2012 19:02 ЙōČhěάŧĪмPĞM-hacked#2
Good or not ?
07/05/2012 21:14 boxxiebabee#3
Bad.
07/05/2012 21:43 Kraizy​#4
hmm..webrequests and webbrowser..hmm
07/06/2012 22:00 deathline4ever#5
@Kraizy er gibt ja nur den sagen wir mal Result aus warum auch immer in einer webbrowser . . . Hätte mit textbox auch gereicht.

I Can´t test it because i don´t develop with vb. But i think it works.
Then by the next way you need to spit the URL to the interface to which server.
Then you need to order them.

Spitt them and make a webrequest.

The Code must look like thus

Quote:
C# Code
Quote:
string strlink = richTextBox1.Lines[438]; //Find the URL in Line 438
string[] arrResult = strlink.Split (new Char[] {'(', ')'}); //Spitt the line
this.richTextBox2.Text = arrResult[1];//The Result.
Then you need to make a Webrequest with that URL
07/07/2012 01:59 ЙōČhěάŧĪмPĞM-hacked#6
How do better in vb.net ??