vb post html,VB如何实现发送POST请求?

满意答案

00e27ab806e4881f8254fe7ae8741834.png

lh841016

2013.12.13

00e27ab806e4881f8254fe7ae8741834.png

采纳率:59%    等级:13

已帮助:8522人

参考一下吧

Private Function ShowIe(ByVal url As String, ByVal user As String, ByVal sn As String)

On Error GoTo ex

'edtPostData.Text = "" ' Initialize an edit box for testing

ReDim aByte(0) As Byte ' Array of bytes to hold data to post

' Extract the URL encoded data from the UI,

' and pack it into an array of bytes

' cFlavor = cboFlavor.List(cboFlavor.ListIndex)

cParamName = "user="

cParamFlavor = "SN="

cSeparator = "&"

cPostData = cParamName & user _

& cSeparator & cParamFlavor & sn

PackBytes aByte(), cPostData

' For testing, rebuild the POST data and stuff

' it into an edit box

For i = LBound(aByte) To UBound(aByte)

edtPostData = edtPostData + Chr(aByte(i))

Next

Dim vPost As Variant

vPost = aByte ' Assign the byte array to a VARIANT

Dim vFlags As Variant

Dim vTarget As Variant

Dim vHeaders As Variant

vHeaders = _

"Content-Type: application/x-www-form-urlencoded" _

+ Chr(10) + Chr(13)

Dim objExplorer As Object

Set objExplorer = CreateObject("InternetExplorer.Application")

objExplorer.Navigate url, _

vFlags, vTarget, vPost, vHeaders objExplorer.Visible = True

Exit Function

ex:

End Function

00分享举报

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值