Post Data Code Example
The following example demonstrates a data Post using the Web control. The function creates a data string from the parameters passed in and submits it to the specified URL.
Private Function PostData(ByVal url As String, ByVal name As String, _
ByVal company As String, ByVal quantity As Integer)
'Set URL of the page to post to.
Web1.Request.url = url
'Add data variables to the Request.
Web1.Request.Variables("name") = name
Web1.Request.Variables("company") = company
Web1.Request.Variables("quantity") = CStr(quantity)
'Submit the data.
Web1.Post
'Return response.
Dim response As String
response = GetVersion(Web1.response.version) + " "
response = response + CStr(Web1.response.Status)
response = response + " " + Web1.response.StatusText + vbCrLf
response = response + Web1.response.Header.All + vbCrLf
response = response + Web1.response.Body.ReadString
PostData = response
End Function
Private Function GetVersion(ByVal version As WebVersionConstants)
GetVersion = ""
If version = webHTTP10 Then GetVersion = "HTTP/1.0"
If version = webHTTP11 Then GetVersion = "HTTP/1.1"
End Function