• WAP手机版 RSS订阅 加入收藏  设为首页
原创软件

vb浏览器WebBrowser参数post登录代码

时间:2021-6-23 0:49:52   作者:来源于网络   来源:幽逸网   阅读:217   评论:0
vb浏览器WebBrowser参数post登录代码Private Sub Command1_Click()

    ReDim aByte(0) As Byte ' Array of bytes to hold data to post
   
    cPostData = "pwdMode=&pwdKey=&pwdEnc=&username=admin&userpwd=admin888&x=49&y=12"
   
    PackBytes aByte(), cPostData
   
    Dim vPost As Variant
   
    vPost = aByte ' Assign the byte array to a VARIANT
   
    Dim vHeaders As Variant
   
    vHeaders = "Content-Type: application/x-www-form-urlencoded" + Chr(10) + Chr(13)
   
    WebBrowser1.Navigate "http://www.u1w.net/admin/admin_cl.asp?mudi=login", , , vPost, vHeaders

End Sub

Private Sub PackBytes(ByteArray() As Byte, ByVal PostData As String)

    iNewBytes = Len(PostData) - 1   ' Get rid of the null termination
   
    If iNewBytes < 0 Then
        Exit Sub
    End If
   
    ReDim ByteArray(iNewBytes)
   
    For i = 0 To iNewBytes
   
        ch = Mid(PostData, i + 1, 1)
        If ch = Space(1) Then
            ch = "+"
        End If
        Debug.Print ch, Asc(ch)
        ByteArray(i) = Asc(ch)
    Next
End Sub

 

Sub getWeb()
 
    Dim X As XMLHTTP
    tmpth = "c:\temp.htm"
    URL = "http://www.baidu.com/"
    Set X = New XMLHTTP
    X.Open "GET", URL, False
    X.send
    s = X.responseText
    ss = "     arr = Split(s, ss)
    ss = ss & arr(1)
    If Dir(tmpth) <> "" Then Kill tmpth
 
    Open tmpth For Output As 1
    Print #1, , ss
    Close 1
    WebBrowser1.Navigate2 tmpth
    Set bd = WebBrowser1.Document.body
    Do While bd Is Nothing
        DoEvents
        Set bd = WebBrowser1.Document.body
    Loop
    SendKeys "c:\baidu.htm"
    SendKeys "{ENTER}"
    WebBrowser1.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER
    Kill tmpth
End Sub


相关评论

本站软件文章均收集于互联网,如有侵权,请联系我们删除,谢谢

鲁ICP备16019059号-4