Click to See Complete Forum and Search --> : Help, "posting" from a program to a HTML form
Jason Gabriel
March 1st, 1999, 08:52 PM
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!!!
AKW
August 3rd, 1999, 12:26 PM
Check out IP*Works at www.dev-soft.com.
IP*Works contains an http control that allows you to post.
-Alex
Lothar Haensler
August 4th, 1999, 02:03 AM
MS WebBrowser Control has a Navigate2 method that has a PostData parameter.
You can use it for posting data.
debuke
April 24th, 2000, 09:11 AM
is this the inet.ocx or is there another control?
thanks!
TCartwright
April 24th, 2000, 10:20 AM
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.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.