zoukankan      html  css  js  c++  java
  • vb6 使用msxml2.serverxmlhttp 请求HTTP

    Private Sub Command1_Click()
    Command1.Enabled = False
    GetHtmlStr Text1
    End Sub

    Private Sub GetHtmlStr(strUrl As String)
    Dim xml As Object '或者Dim xml As New ServerXMLHTTP

    Set xml = CreateObject("msxml2.serverxmlhttp")
    xml.Open "GET", strUrl, False
    xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xml.setRequestHeader "Accept-Language", "zh-cn"
    xml.setRequestHeader "Accept-Encoding", "gzip, deflate"
    xml.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
    
    xml.send
    Do While xml.readyState <> 4
        DoEvents
    Loop
    Text2 = StrConv(xml.ResponseBody, vbUnicode)
    Set xml = Nothing
    Command1.Enabled = True
    

    End Sub

  • 相关阅读:
    MongoDB
    新公司管理经营
    剪辑理论
    色彩理论
    商业模式
    电影手法
    [好文转载] 每个程序员都应该学习使用Python或Ruby
    File类递归
    【CF1447】div2复盘
    【心得体会】11.9-11.15
  • 原文地址:https://www.cnblogs.com/wgscd/p/5206917.html
Copyright © 2011-2022 走看看