vb Code:
Sub GetRating()
Dim wc As New Net.WebClient
' Add this if you're using a proxy for Internet connection
' wc.Proxy = Net.WebRequest.DefaultWebProxy
' Add this if your web-proxy needs authentication
' wc.Proxy.Credentials = New Net.NetworkCredential("username", "password")
Dim htmlcode As String = ""
Try
Using rd As New IO.StreamReader(wc.OpenRead("http://www.imdb.com/title/tt0435761/"))
htmlcode = rd.ReadToEnd
End Using
Catch ex As Net.WebException
' Web error (404, 401, 403, etc)
Catch ex As Exception
' Other error
End Try
Dim rating As String = ""
If Not htmlcode = "" Then
Dim pattern As String = "<div class=""starbar-meta"">"
Dim p As Integer = htmlcode.IndexOf(pattern)
p += pattern.Length
rating = htmlcode.Substring(p, htmlcode.IndexOf("</b>", p) - p)
rating = rating.Replace("<b>", String.Empty).Trim
MsgBox(rating)
Else
MsgBox("No data to display")
End If
End Sub