Xbasic

curl_post_data Function

Syntax

DIM result AS P = curl_post_data(url AS C, data AS C [, headers AS C [, timeout AS N]])

Arguments

urlCharacter

Url endpoint to post data.

dataCharacter

The information to send to the endpoint.

headersCharacter

A comma-delimited list of headers. Headers must be specified in the following format:

headername:headervalue

For example:

apikey:123456789,content-type:application/json,cache-control:no-cache
timeoutNumeric

Optional timeout in seconds. If omitted, the default timeout is 10 seconds.

In builds prior to 9773, this function did not enforce a timeout.

If timeout is set to 0, then no timeout is set.

Returns

resultPointer

Returns an object with the following properties:

errorLogical

A .t. or .f. value. If .t., an error occurred. If .f., no error occurred.

headersCharacter

If no error occurs, contains the headers from the POST response. This property only exists if error is false.

contentsCharacter

If no error occurs, contains the content from the POST response. This property only exists if error is .f..

errorTextCharacter

If an error occurs, contains the error message. This property only exists if error is .t..

Description

POST data to a URL. Uses the Extension::CURL object internally.

See Also