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_init | Allocate the cURL environment
|
curl_free | Release the cURL environment
|
curl_reset | Reset cURL options
|
curl_header | Return header from cURL request
|
curl_execurl | Set a URL and execute the request
|
curl_setopt | Set one or more cURL options. cURL options are
specified in pairs: CURLOPT_nnnn,value. See trimcurl.h for a list
of CURLOPT_nnnn values. CURLOPT_HTTPHEADER can set multiple comma-delimited header options.
|
curl_exec | Execute the cURL request
|
curl_version | Return 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);
}