ccc125l87l92l206cad32
fy53999
飞快的心情fy53999

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

posted on 2019-11-05 23:11  fy53999  阅读(240)  评论(0编辑  收藏  举报