HttpWebRequest Extract Links or URLS From My Blog...

TeachMe

Member
Joined
Jun 27, 2012
Messages
16
Programming Experience
Beginner
I would like to use the httpwebrequest to pull all the links from my blog. I would like for the links to be extracted and sent to a textbox1.text from the httpwebrequest method.
Here's the example that I have to extract all the html source code, but all I need is the URLs from my web page:

Try TextBox1.Text = "" Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://membersofilluminati.blogspot.com/") 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 Catch ex As Exception End Try

Could someone please show me how to convert this to extract/parse only links or URLs from the web page and send it to Textbox1.text???
Thanks...
 
I recommend you download and use this library: Html Agility Pack
There's a basic usage example in C# close to your need, click the Examples link down the page.
 
Back
Top