New Way Of Getting A Webpage Source

Promotion Mar 2, 2013

  1. Promotion

    Promotion Banned
    0/47

    Joined:
    Feb 18, 2013
    Messages:
    231
    Likes Received:
    142
    Trophy Points:
    0
    Console:
    Xbox
    Picture
    [​IMG]
    My Code - Source

    Code:
    Imports System.Net
    Public Class Form1
        '--
        'All Credits Goes To Promotion, HF: Siked
        '--
        'Youtube.com/TheYTPromotion
        '--
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Download()
        End Sub
     
        Public Sub Download()
            Dim Web As New WebClient
            Dim update As String = Web.DownloadString(TextBox2.Text)
            TextBox1.Text = Web.DownloadString(TextBox2.Text)
        End Sub
    End Class
    Original Code - Source

    Code:
    Public Class Form1
    
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(TextBox2.Text)
            Dim response As System.Net.HttpWebResponse = request.GetResponse()
    
            Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
    
            Dim sourcecode As String = sr.ReadToEnd()
    
            TextBox1.Text = sourcecode
        End Sub
    
    End Class
    My code is easier and it runs faster, also the old one has more code than mine, enjoy!
     

Share This Page

Close