Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: [VB.net] Open "page source" from URI in VB.net  (Read 3836 times)

0 Members and 1 Guest are viewing this topic.

liambiscuit

    Topic Starter


    Hopeful

    [VB.net] Open "page source" from URI in VB.net
    « 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
    " When the rich wage war its the Poor who die "
            Linkin Park



    Whoever said that nothing is impossible has obviously never tried to slam a revolving door. -- Lauren

    You cannot buy your friends but you can buy them pizza - AzureBlade49