このような関数はデータを文字列として抽出しますが、その中のデータを自分で解析する必要があります:
Public Shared Function GetWebPageData(ByVal address As Uri) As String
Dim request As HttpWebRequest
Try
request = DirectCast(WebRequest.Create(address), HttpWebRequest)
Using response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
Using reader As StreamReader = New StreamReader(response.GetResponseStream())
Return reader.ReadToEnd
End Using
End Using
Catch ex As Exception
'TODO handle the error here....
Return ""
End Try
End Function
使用法:
Dim xml As String = Networking.GetWebPageData(New Uri("http://www.hitta.se/077-570%2005%2000/f%C3%B6retag_och_personer"))
Debug.WriteLine(xml)