VB.net GET网站并获取Cookie
调用方法 Get_html(Get网址,编码类型)
Public Function Get_Html(ByVal Html_url As String, ByVal IsGb2312 As Boolean)
On Error Resume Next
Dim XmlHttp As Object
XmlHttp = CreateObject("Microsoft.XMLHttp")
XmlHttp.Open("GET", Html_url, False)
XmlHttp.Send()
Dim WebContent As Object
Dim Str_WebContent As String
If IsGb2312 Then
WebContent = XmlHttp.ResponseBody
Str_WebContent = System.Text.Encoding.Default.GetString(WebContent)
Else
WebContent = XmlHttp.ResponseText
Str_WebContent = WebContent.ToString
End If
CookieData = XmlHttp.getResponseHeader("Set-Cookie") '获取Cookie获取
XmlHttp = Nothing
Get_Html = Str_WebContent
End Function