VB向网页POST数据

jamtoday 2007-11-27 01:40:15
新手初学VB 大家多多阿里阿多


假设程序 text1.text 获取了信息 然后自动发送到 http://127.0.0.1/post.asp post.asp会request数据 怎么做.

我希望能有完整的一个实例.
...全文
1262 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
challenge1 2009-09-07
  • 打赏
  • 举报
回复
怎样post文件呢?

-----------------------------------------------------------------------
人脑潜能开发,潜能开发音乐下载 www.qn21.com
challenge1 2009-09-07
  • 打赏
  • 举报
回复
对啊,怎样post文件呢?
meiZiNick 2008-05-01
  • 打赏
  • 举报
回复
lz要干嘛?
asyncyd 2007-12-13
  • 打赏
  • 举报
回复
怎样post文件呢?
lailaibaby 2007-12-10
  • 打赏
  • 举报
回复
看不懂,先收起来!
cangwu_lee 2007-11-27
  • 打赏
  • 举报
回复
MSXML2.XMLHTTP

有點像 AJAX
jamtoday 2007-11-27
  • 打赏
  • 举报
回复
问题已经解决 找了一个下午的代码 baidu真垃圾 还是 google.cn专业哦/

Private Sub Command1_Click()
Dim comfile
Dim comid

strA = URLEncoding("comfile=xp.dll,中文可以不.&comid=hyxd111")
Set http = CreateObject("MSXML2.XMLHTTP")

With http
.Open "POST ", "http://127.0.0.1/post.asp", False
.setRequestHeader "Content-Type ", "application/x-www-form-urlencoded "
.setRequestHeader "Content-Length ", Len(strA)
.send strA
Text1.Text = bytes2BSTR(.responseBody)
End With

Label1.Caption = "完成 "
End Sub



Function URLEncoding(vstrIn)
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vstrIn, i, 1)
If Abs(Asc(ThisChr)) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00) \ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function

Function bytes2BSTR(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn, i, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
jamtoday 2007-11-27
  • 打赏
  • 举报
回复
post.asp 我会处理接受的数据. vb发送数据我不会.

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧