CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 1999
    Posts
    1

    Help, "posting" from a program to a HTML form



    I am familiar with "Get" query strings and passing them to an HTML form, but how can I "POST" to a html form from my application?


    Any help would be greeeatly appreciated!!!

  2. #2
    Join Date
    Aug 1999
    Posts
    3

    Re: Help, "posting" from a program to a HTML form

    Check out IP*Works at www.dev-soft.com.
    IP*Works contains an http control that allows you to post.
    -Alex


  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: Help, "posting" from a program to a HTML form

    MS WebBrowser Control has a Navigate2 method that has a PostData parameter.
    You can use it for posting data.


  4. #4
    Join Date
    Aug 1999
    Posts
    50

    Re: Help, "posting" from a program to a HTML form

    is this the inet.ocx or is there another control?

    thanks!


  5. #5
    Join Date
    Apr 2000
    Location
    Houston, TX, USA
    Posts
    199

    Re: Help, "posting" from a program to a HTML form

    You can use the Internet Transfer Control that comes with VB. To Use :
    Place an Internet Transfer Control onto your form. and then paste teh below code in modifying the URL.


    private Function URLEncode(byval strData as string) as string
    Dim intX as Integer
    Dim strChar as string
    Dim strTemp as string

    for intX = 1 to len(strData)
    strChar = mid$(strData, intX, 1)
    Select Case Asc(strChar)
    Case 65 to 90, 97 to 122, 48 to 57 ' "A - Z", "a - z", "0 - 9"
    strTemp = strTemp & strChar
    Case 32 ' " "
    strTemp = strTemp & "+"
    Case else
    strTemp = strTemp & "%" & Hex(Asc(strChar))
    End Select
    next intX

    URLEncode = strTemp

    End Function

    '***********IN FORM LOAD*****************************
    Dim strPost as string
    Dim strTime as string

    strPost = strPost & URLEncode("Var1") & "=" & URLEncode(Trim$("This is my first value"))
    strPost = strPost & "&" 'variable seperator
    strPost = strPost & URLEncode("Var2") & "=" & URLEncode(Trim$("This is my second value"))

    Inet1.Execute Trim$("http://www.server.com/mysite/mypage.asp"), "POST", strPost, "Content-Type: application/x-www-form-urlencoded"

    Do While Inet1.StillExecuting
    'this is here to keep from happening the infinite loop
    'if the inet control does not respond within one minute then
    'stop listening for this post, now we listen to the StateChanged event
    If strTime = "" then
    strTime = time
    else
    If DateDiff("n", time, strTime) > 1 then Exit Do
    End If
    DoEvents 'allow the event to process the message
    Loop
    strTime = ""





    Tim Cartwright 'Will write code for food.
    Information Systems
    Splitrock Services Inc.
    Tim C.
    //Will write code for food

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

Featured