Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Getting a webpage title using httpwebrequest

$
0
0
Hello everyone, I've been playing with this for a few hours now and haven't gotten any results.

I'm trying to use a HttpWebRequest and HttpWebResponse to get what is in between the <title></title> tags of a website.

Whenever I try and get back what I'm looking for I get a blank statement.

For testing I used the following code (I would not like to use a WebBrowser) to test this and still my results were a failure.

Me.WebBrowser1.Navigate(New Uri("http://www.yahoo.com"))

        Me.ListBox1.Items.Add("Type" & "-->" & "Name")

        For Each element As HtmlElement In Me.WebBrowser1.document.All

            Me.ListBox1.Items.Add(element.TagName() & "-->" & element.Id)

        Next

    End Sub



This code is supposed to pull out the elements of a website, I was going to pick out the title element but this wont even list and gives me an error on
For Each element As HtmlElement In Me.WebBrowser1.document.All

saying "Object reference not set to an instance of an object."

I was just using this for testing and wouldn't like to do it this way.

Any Suggestions of where I can start would be much appreciated, thanks.

Viewing all articles
Browse latest Browse all 51036

Trending Articles