curl

Execute cURL functions.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X X X

Syntax

expr curl(option[,parm[,...]])
int       option
expr      parm

Description

Creates and executes a cURL command. The option values are defined in trim.h:
curl_initAllocate the cURL environment
curl_freeRelease the cURL environment
curl_resetReset cURL options
curl_headerReturn header from cURL request
curl_execurlSet a URL and execute the request
curl_setoptSet one or more cURL options. cURL options are specified in pairs: CURLOPT_nnnn,value. See trimcurl.h for a list of CURLOPT_nnnn values.
curl_execExecute the cURL request
curl_versionReturn the cURL version as a string
Data is returned into the clipboard.

Notes

The curl function uses a shared library cexcurl.so. If is not available, then curl() returns an error.

Examples

Execute a cURL to return the contents of a web page:
#include trimcurl.h                         /* contains CURLOPT_xxx values    */
{
list LL;

curl(curl_init);
curl(curl_header);                          /* include header in output       */

#ifdef use_setopt
curl(curl_setopt,CURLOPT_PORT,80,
                 CURLOPT_URL,"www.trifox.com");
curl(curl_exec);
#else
curl(curl_execurl,"www.trifox.com");        /* same as above 2 calls          */
#endif

LL = list_open("clipboard!",9999);          /* output is in the clipboard     */
list_view(LL,0);
}