PostDataStart

Description

Starts sending the data with POST method.

If IgnoreServerCertificate or CheckForServerCertRevocation is set to verify the server certificate, and if the verification fails, an error code will be returned.

Applies to

HTTPClient objects

Syntax

objectname.PostDataStart ( urlName )

Argument

Description

objectname

The name of the HTTPClient object for which you want to start posting data.

urlName

A string value specifying the URL.


Return value

Integer.

Returns values as follows. If any argument's value is null, the method returns null.

1 -- Success

-1 -- General error

-2 -- Invalid URL

-3 -- Cannot connect to the Internet

-4 -- Timed out

-7 -- Certification revocation checking has been enabled, but the revocation check failed to verify whether a certificate has been revoked. The server used to check for revocation might be unreachable.

-8 -- SSL certificate is invalid.

-9 -- SSL certificate was revoked.

-10 -- The function is unfamiliar with the Certificate Authority that generated the server's certificate.

-11 -- SSL certificate common name (host name field) is incorrect, for example, if you entered www.appeon.com and the common name on the certificate says www.demo.appeon.com.

-12 -- SSL certificate date that was received from the server is bad. The certificate is expired.

-13 -- The certificate was not issued for server authenticate purpose.

-14 -- The application experienced an internal error loading the SSL libraries.

-15 -- More than one type of errors when validating the server certificate.

Examples

This example requests information in a loop:

Integer i, li_PackCount, li_rc
Blob lblb_photo, lblb_NextData
HttpClient lnv_HttpClient
lnv_HttpClient = Create HttpClient

// Read photo to lblb_photo and calculate li_PackCount
//...
lnv_HttpClient.SetRequestHeader("Content-Type", "multipart/form-data; boundary--------------------------359875084413580694217125")
// Construct a POST request
lnv_HttpClient.SetRequestHeader("Content-Length", string(len(lblb_photo)))

// Start posting data and request information
if lnv_HttpClient.PostDataStart("https://demo.appeon.com/PB/webapi_client/employee/102/photo") = 1 then
 for i = 1 to li_PackCount
  lblb_NextData = blobmid(lblb_photo, (i - 1) * 1024 + 1, 1024)
  li_rc = lnv_HttpClient.PostData(lblb_NextData, 1024)
  if li_rc <> 1 then exit
 next
end if

if li_rc = 1 then
 li_rc = lnv_HttpClient.PostDataEnd()
end if

See also

PostData

PostDataEnd