Computer Hope

Software => Computer programming => Topic started by: liambiscuit on August 08, 2009, 03:55:06 PM

Title: [VB.net] Open "page source" from URI in VB.net
Post by: liambiscuit on August 08, 2009, 03:55:06 PM
I want to open the same text you get from right clicking in the background of your browser->view source and load it into a string.

The whole file is very short ATM so i am posting it all.

Code: [Select]
Imports System
Imports System.IO

Module Module1

    Sub Main()
        Try
            ' Create an instance of StreamReader to read from Hulu.com
            Dim sr As StreamReader = New StreamReader("http://www.hulu.com/search?query=type%3Amovie")
            Dim line As String
            ' Read and display the lines from the file until the end
            ' of the file is reached.
            Do
                line = sr.ReadLine()
                Console.WriteLine(line)
            Loop Until line Is Nothing
            sr.Close()
        Catch E As Exception
            ' Let the user know what went wrong.
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(E.Message)
        End Try
        Console.Read()
    End Sub
End Module

Thanks in advance,
Liam