vb发post信息,非常简单,就一个函数

如题

Function HttpPost(Url As String, PostMsg As String) As String

'自己写的发送Post的函数

'函数返回值是获得的返回信息(HTML)

'第一个参数是要发送的Url地址

'第二个参数是要发送的消息(键值对应,不必编码)

Dim XmlHttp As Object

Set XmlHttp = CreateObject("Msxml2.XMLHTTP")

If Not IsObject(XmlHttp) Then

Set XmlHttp = CreateObject("Microsoft.XMLHTTP")

If Not IsObject(XmlHttp) Then Exit Function

End If

XmlHttp.Open "POST", Url, False

XmlHttp.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"

XmlHttp.Send EnUrl(PostMsg)

Do While XmlHttp.readyState <> 4

DoEvents

Loop

'如果把下面一行(以及后面的End IF)的注释去除,即设置为仅当返回码是200时才返回页面内容

'If XmlHttp.Status = 200 Then

HttpPost = XmlHttp.responseText

'End If

End Function

直接把这个函数放进窗体/模块里就行,不必引用任何东西

用法:

msgbox httppost("http://baidu.com","name1=value1&name2=value2")

(上面的地址和参数是瞎写的)

-------------------

本人制作的非常非常垃圾的网站http://jybox.net