Problem using "GET" after "POST" in Inet Control 
Author Message
 Problem using "GET" after "POST" in Inet Control

Hello,

I've been toying in MSDN with the small example of how to "POST" to a
CGI script on a webpage.  The "POST" works perfectly but I can't figure
out how to "GET" the response back from the website.  Here is the code
that I have:

Dim strURL As String
Dim strFormData As String

strURL = " http://www.*-*-*.com/ ;


Inet1.Execute strURL, "POST", strFormData

While Inet1.StillExecuting
        DoEvents
Wend

Inet1.Execute strURL, "GET"

Private Sub Inet1_StateChanged(ByVal State As Integer)

    Dim strResponse

    Select Case State

    Case icResponseCompleted '12

        Dim vtData As Variant
        Dim strResponse As String

        vtData = Inet1.GetChunk(1024, icString)

        Do While LenB(vtData) > 0

            strResponse = strResponse & vtData

            vtData = Inet1.GetChunk(1024, icString)

        Loop

    End Select

    MsgBox strResponse

End Sub

When I perform the following, I never get the icResponseCompleted.

Thanks for any help that you can offer.

Marc



Sun, 04 May 2003 03:00:00 GMT  
 Problem using "GET" after "POST" in Inet Control
Hi Marc,
you don't need to GET the results. POST will do it perfectly.
GET or POST is just the difference how you send your strFormData to the
server and how the server has to read it.
The result will be send "automagically" to you, just syncronize your
DoEvents loop with another variable:
Dim bResponseComplete as Boolean
Before the Execute:
bResponseComplete = False

In Inet1_StateChanged set it to true when you're finished. Get your DoEvents
loop break when bResponseComplete is set to true.

Elmar


Quote:

> Hello,

> I've been toying in MSDN with the small example of how to "POST" to a
> CGI script on a webpage.  The "POST" works perfectly but I can't figure
> out how to "GET" the response back from the website.  Here is the code
> that I have:

> Dim strURL As String
> Dim strFormData As String

> strURL = "http://www.mytest.com/cgi-bin/test.pl"


> Inet1.Execute strURL, "POST", strFormData

> While Inet1.StillExecuting
>         DoEvents
> Wend

> Inet1.Execute strURL, "GET"

> Private Sub Inet1_StateChanged(ByVal State As Integer)

>     Dim strResponse

>     Select Case State

>     Case icResponseCompleted '12

>         Dim vtData As Variant
>         Dim strResponse As String

>         vtData = Inet1.GetChunk(1024, icString)

>         Do While LenB(vtData) > 0

>             strResponse = strResponse & vtData

>             vtData = Inet1.GetChunk(1024, icString)

>         Loop

>     End Select

>     MsgBox strResponse

> End Sub

> When I perform the following, I never get the icResponseCompleted.

> Thanks for any help that you can offer.

> Marc



Mon, 05 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using "POST" method in INET control

2. Inet control "POST"

3. Problem With "window.showmodaldialog("")"

4. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

5. Inet Question re: Execute , "POST", strFormData

6. GetObject("","InternetExplorer.Application") fails in Excel VBA

7. SysCmd 603, "path","path"

8. Disabling "BACK"/"FORWARD" buttons

9. Loop print "VARIABLE", "VARIABLE"

10. DLL or something like "#"#¤#"!"#

11. Disabling "BACK"/"FORWARD" buttons

12. CreateObject("Excel","//server"), MsgBox output

 

 
Powered by phpBB® Forum Software