MSDNのドキュメントによると、質問の解決策は次のとおりです。
Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
Console.WriteLine(ControlChars.Lf + ControlChars.Cr + "The following headers were received in the response")
Dim i As Integer
While i < myHttpWebResponse.Headers.Count
Console.WriteLine(ControlChars.Cr + "Header Name:{0}, Value :{1}", myHttpWebResponse.Headers.Keys(i), myHttpWebResponse.Headers(i))
i = i + 1
End While
myHttpWebResponse.Close()
このコードを説明しましょう1行目は指定されたURLでHttpWebRequestを作成し、2行目と3行目はURIから受信した応答に存在するすべてのヘッダーを表示します。4行目から8行目-HeadersプロパティはWebHeaderCollectionです。そのプロパティを使用してコレクションをトラバースし、各ヘッダーと10番目を表示してリクエストを閉じます。Webページのヘッド部分のみが必要な場合は、PHPクラスをhttp://www.phpclasses.org/package/4033で無料で入手できます。 -PHP-Extract-HTML-contained-in-tags-from-a-Web-page.html