Results 1 to 3 of 3

Thread: Inet.Execute "Post" ??????????????????

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    12

    Angry Inet.Execute "Post" ??????????????????

    Does anyone have an example of the Internet Transfer Control using the post method that WORKS?

    Microsoft says Using the Execute Method with the Common Gateway Interface you would do like this:

    strURL = "//www.yippee.com/cgi-bin/find.exe"
    strFormData = "find=Hangzhou"
    Inet1.Execute strURL, "POST", strFormData

    But, they say that posting to an ASP form you have to add the header information....
    "INFO: Header Required Posting HTML Form Encoded Data to ASP Page"

    They say the format would be like this:

    Private Sub Command2_Click()
    Dim strURL As String, strFormData As String
    'Change the server to your server name
    strURL = "http://yourserver/scripts/testpost.asp"
    strFormData = "lname=Doe&fname=John"
    Inet1.Execute strURL, "Post", strFormData, _
    "Content-Type: application/x-www-form-urlencoded"
    End Sub

    I have tried this and I can't get the dang thing to work.....

    IF ANYONE HAS AN EXAMPLE LIKE THIS WORKING PLEASE HELP!!!!!

    Here's a live example...if someone could help me get just this working, I can apply this to the site I am working on which requires a user name and password so I don't want to post that here....

    but...here goes...you need a webbrowser on your form called WebBrowser1 and the Internet Transfer Control called Inet

    Private Sub Command1_Click()

    Dim strURL As String, strFormData As String

    strURL = "http://www.ubid.com/app/search/search.asp"
    strFormData = "trgt_siteid=1&scrtext=computer"

    Inet.Execute strURL, "POST", strFormData, "Content-Type: application/x-www-form-urlencoded"
    WebBrowser1.Navigate Inet.URL
    End Sub

    Here is the actual form in the ASP page this would be posting to:

    <form action="/app/search/search.asp?trgt_siteid=1" id="FORM1" method="post" name="FORM1">
    <td valign="top">
    <input type="text" id="text1" name="scrtext" size="10" />
    <input id="submit1" name="submit1" type="submit" value="Go" />
    <br />
    </td>
    </form>

    I have tried both setting strURL and strFormData both of the following ways:

    strURL = "http://www.ubid.com/app/search/search.asp"
    strFormData = "trgt_siteid=1&scrtext=computer"

    and

    strURL = "http://www.ubid.com/app/search/search.asp?trgt_siteid=1"
    strFormData = "scrtext=computer"

    I get the same results each time......

    the search page comes back saying:

    "Search Results for the Keyword - ""
    Sorry, No results found for this search"

    so, obviously my strFromData is not being included....

    ??????????

    I just attached a small project if anyone wants to download it. It's like my example above but rather than hard coding a search on Ubids site for "computer" I entered a Text box on the form to be able to search for whatever word is put in the text box...But...it still doesn't work...can someone PLEASE tell me what I am doing wrong?
    Attached Files Attached Files
    Last edited by Webauctioneer; Apr 24th, 2001 at 09:38 PM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    12

    Exclamation More info on this...

    Well...even though I haven't gotten any responses on this, I thought I would post what I have found....

    THIS FREAKING THING DOESN'T WORK!!!!!!!!!!!!!!!!

    I setup another little VB app to check status on a USPS
    Delivery Confirmation Number....

    Private Sub Command1_Click()
    Dim strURL As String, strFormData As String
    strFormData = "tracknbr=" + Text2.Text
    strURL = "http://www.usps.com/cgi-bin/cttgate/ontrack.cgi?"
    Inet.Execute strURL + strFormData, "POST", _
    "Content-Type: application/x-www-form-urlencoded"
    WebBrowser1.Navigate Inet.URL
    Text1.Text = Inet.URL
    End Sub

    This works...but it's really not doing it the right way.

    Notice in the Inet.Execute to get it to post the complete string that I need I am adding strURL and strFormData together before stating the "POST" method. And I have to add a "?" on the end of the action URL. This is working but according to Microsoft, it should be:

    Inet.Execute strURL, "POST", strFormData, _
    "Content-Type: application/x-www-form-urlencoded"

    And you shouldn't have to put the "?" at the end of the action URL.
    But, in that format with or without the "?" it does not pass the strFormData to the form, it passes ONLY the action URL.

    SO....anybody?.....anybody?....is there something I just don't get here or is Microsoft wrong about the format?

  3. #3
    New Member
    Join Date
    Jun 2001
    Posts
    1

    Add vbCrLf

    You forgot "& vbCrLF" for the Content-Type

    Inet.Execute strURL, "POST", strFormData,"Content-Type: application/x-www-form-urlencoded" & vbCrLf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width