1.2

| home | graph lib | utility lib | auxiliary lib | custom lib | tutorials |

   Curl
   Expact
   SQLITE
   Window

zeCurl

Use .new("curl") to create the object. It is a simple binding of CURL library.

:version()

Returns the version number as string.

:callback(read, write, flag)

read - Lua function name.
write - Lua function name.
flag - positive number for binary output; other for text output.

Sets callback functions. The read function alway receives a lightuserdata, the number of byte of a datum, and the number of data. The write function receives a string if flag is zero; otherwise the same contents as the read function.

:set(table)

table - a Lua table.

Sets object properties. Valid key-value paris are listed in the table. Please refer to CURL document for curl_easy_setopt function for details.

Key Value Type Remark
VERBOSE n Number curl_easy_setopt(curl, CURLOPT_VERBOSE, n)
HEADER n Number curl_easy_setopt(curl, CURLOPT_HEADER, n)
URL n Number curl_easy_setopt(curl, CURLOPT_URL, n)
PROXY s String curl_easy_setopt(curl, CURLOPT_PROXY, s)
PROXYPORT n Number curl_easy_setopt(curl, CURLOPT_PORT, n)
PROXY_HTTP a Any curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP)
PROXY_SOCKS5 a Any curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5)
HTTPPROXYTUNNEL n Number curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, n)
INTERFACE s String curl_easy_setopt(curl, CURLOPT_INTERFACE, s)
DNS_CACHE_TIMEOUT n Number curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, n)
DNS_USE_GLOBAL_CACHE n Number curl_easy_setopt(curl, CURLOPT_DNS_USE_GLOBAL_CACHE, n)
BUFFERSIZE n Number curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, n)
PORT n Number curl_easy_setopt(curl, CURLOPT_PORT, n)
TCP_NODELAY n Number curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, n)
NETRC_OPTIONAL a Any curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL)
NETRC_IGNORED a Any curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_IGNORED)
NETRC_REQUIRED a Any curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_REQUIRED)
NETRC_FILE s String curl_easy_setopt(curl, CURLOPT_NETRC_FILE, s)
USERPWD s String curl_easy_setopt(curl, CURLOPT_USERPWD, s)
PROXYUSERPWD s String curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, s)
AUTOREFERER n Number curl_easy_setopt(curl, CURLOPT_AUTOREFERER, n)
FOLLOWLOCATION n Number curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, n)
UNRESTRICTED_AUTH n Number curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, n)
MAXREDIRS n Number curl_easy_setopt(curl, CURLOPT_MAXREDIRS, n)
PUT n Number curl_easy_setopt(curl, CURLOPT_PUT, n)
POST n Number curl_easy_setopt(curl, CURLOPT_POST, n)
POSTFIELDS s String curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s)
REFERER s String curl_easy_setopt(curl, CURLOPT_REFERER, s)
USERAGENT s String curl_easy_setopt(curl, CURLOPT_USERAGENT, s);
COOKIE s String curl_easy_setopt(curl, CURLOPT_COOKIE, s)
COOKIEFILE s String curl_easy_setopt(curl, CURLOPT_COOKIEFILE, s)
COOKIEJAR s String curl_easy_setopt(curl, CURLOPT_COOKIEJAR, s)
COOKIESESSION n Number curl_easy_setopt(curl, CURLOPT_COOKIESESSION, n)
HTTPGET n Number curl_easy_setopt(curl, CURLOPT_HTTPGET, n)
HTTP_VERSION_NONE a Any curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE)
HTTP_VERSION_1_0 a Any curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0)
HTTP_VERSION_1_1 a Any curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1)
FTPPORT s String curl_easy_setopt(curl, CURLOPT_FTPPORT, s)
FTPLISTONLY n Number curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, n)
FTPAPPEND n Number curl_easy_setopt(curl, CURLOPT_FTPAPPEND, n)
FTP_USE_EPRT n Number curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, n)
FTP_USE_EPSV n Number curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, n)
FTP_CREATE_MISSING_DIRS n Number curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, n)
FTP_RESPONSE_TIMEOUT n Number curl_easy_setopt(curl, CURLOPT_FTP_RESPONSE_TIMEOUT, n)
TRANSFERTEXT n Number curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, n)
CRLF n Number curl_easy_setopt(curl, CURLOPT_CRLF, n)
RANGE s String curl_easy_setopt(curl, CURLOPT_RANGE, s)
RESUME_FROM n Number curl_easy_setopt(curl, CURLOPT_RESUME_FROM, n)
CUSTOMREQUEST s String curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, s)
FILETIME n Number curl_easy_setopt(curl, CURLOPT_FILETIME, n)
NOBODY n Number curl_easy_setopt(curl, CURLOPT_NOBODY, n)
INFILESIZE n Number curl_easy_setopt(curl, CURLOPT_INFILESIZE, n)
UPLOAD n Number curl_easy_setopt(curl, CURLOPT_UPLOAD, n)
MAXFILESIZE n Number curl_easy_setopt(curl, CURLOPT_MAXFILESIZE, n)
TIMECONDITION n Number curl_easy_setopt(curl, CURLOPT_TIMECONDITION, n)
TIMEVALUE n Number curl_easy_setopt(curl, CURLOPT_TIMEVALUE, n)
TIMEOUT n Number curl_easy_setopt(curl, CURLOPT_TIMEOUT, n)
LOW_SPEED_LIMIT n Number curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, n)
LOW_SPEED_TIME n Number curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, n)
MAXCONNECTS n Number curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, n)
CLOSEPOLICY n Number curl_easy_setopt(curl, CURLOPT_CLOSEPOLICY, n)
FRESH_CONNECT n Number curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, n)
FORBID_REUSE n Number curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, n)
CONNECTTIMEOUT n Number curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, n)
IPRESOLVE_WHATEVER a Any curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER)
IPRESOLVE_V4 a Any curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4)
IPRESOLVE_V6 a Any curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6)