我用inet控件POST数据之后,我想继续浏览登录后的页面需要用什么代码?
比如我现在用POST方法成功登录了一个论坛,我该用什么方法才能查看其他内容?
Private Sub Command1_Click()
Dim url As String
Dim tmp As String
Dim data As String
url = "http://127.0.0.1/bbselse.asp"
data = "lgname=mengshixu&lgpwd=mengshixu&cook=0&lgtype=s&Submit=+%B5%C7+%C2%BD+"
Inet1.Execute url, "post", data, "content-type: application/x-www-form-urlencoded"
start: Do Until Inet1.StillExecuting
DoEvents
Loop
Do Until Inet1.StillExecuting
Inet1.OpenURL "http://127.0.0.1/index.asp"
Loop
If Not Inet1.StillExecuting Then
Inet1.OpenURL "http://127.0.0.1/index.asp"
Else
DoEvents
GoTo start
End If
End SubPrivate Sub Inet1_StateChanged(ByVal State As Integer)
   Dim vtData As Variant ' Data variable.
   Select Case State
   '...没有列举其它情况。
   Case icError '11
      '出现错误时,返回 ResponseCode 和 ResponseInfo。
      vtData = Inet1.ResponseCode & ":" & _
      Inet1.ResponseInfo
   Case icResponseCompleted ' 12
      
      Dim strData As String
      Dim bDone As Boolean: bDone = False      '取得第一个块。
      vtData = Inet1.GetChunk(1024, icString)
      DoEvents      Do While Not bDone
         strData = strData & vtData
         '取得下一个块。
         vtData = Inet1.GetChunk(1024, icString)
         DoEvents         If Len(vtData) = 0 Then
            bDone = True
         End If
      Loop
      Debug.Print strDataEnd Select
End Sub
-----------------------------------------------------
该在那个位置添加语句继续浏览下一个页面???
比如我想在登陆后浏览http://127.0.0.1/index.asp这个页面,我该怎么做?谢谢各位!

解决方案 »

  1.   

    这时你要分析你得到的HTML代码,有多少个URL连接,那个URL是你想要去看的
      

  2.   

    Private Sub Inet1_StateChanged(ByVal State As Integer)
       Dim vtData As Variant ' Data variable.
       Select Case State
       '...没有列举其它情况。
       Case icError '11
          '出现错误时,返回 ResponseCode 和 ResponseInfo。
          vtData = Inet1.ResponseCode & ":" & _
          Inet1.ResponseInfo
       Case icResponseCompleted ' 12
          
          Dim strData As String
          Dim bDone As Boolean: bDone = False      '取得第一个块。
          vtData = Inet1.GetChunk(1024, icString)
          DoEvents      Do While Not bDone
             strData = strData & vtData
             '取得下一个块。
             vtData = Inet1.GetChunk(1024, icString)
             DoEvents         If Len(vtData) = 0 Then
                bDone = True
             End If
          Loop
          Debug.Print strData
    temp = Inet1.OpenURL("http://127.0.0.1/index.asp", 0)
    Debug.Print temp
    End SelectEnd Sub
    ----------------------------------------------------
    我把函数改成这样的了,在结尾加了个参数temp = Inet1.OpenURL("http://127.0.0.1/index.asp", 0)太笨了,忘记用变量接受数据了。谢谢关注。