-
curl_write_callback (atom, atom, atom, atom)
Params:
-
atom ptr
-
atom size
-
atom nmemb
-
atom stream
-
curl_read_callback (atom, atom, atom, atom)
Params:
-
atom ptr
-
atom size
-
atom nmemb
-
atom stream
-
curl_strequal (sequence, sequence)
checks whether two strings are equal.
Params:
-
sequence s1
first string to compare
-
sequence s2
second string to compare
Description:
subject for removal in a future libcurl
Return:
integer
* 1 ; the strings are identical.
* 0 ; the strings are different.
Example:
? curl_strequal("first", "first")
1
? curl_strequal("first", "first2")
0
See also:
curl_strnequal
-
curl_strnequal (sequence, sequence, atom)
checks whether the first n chars of two strings are equal.
Params:
Description:
subject for removal in a future libcurl
Return:
integer
* 1 ; the first n chars of the strings are identical.
* 0 ; the first n chars of the strings are different.
Example:
? curl_strnequal("first", "first2", 5)
1
See also:
curl_strequal
-
curl_formadd (atom, atom, atom)
Params:
Description:
Pretty advanced global function for building multi-part formposts. Each
invoke adds one part that together construct a full post.
Then use CURLOPT_HTTPPOST to send it off to libcurl.
Return:
integer
See also:
curl_formget, curl_formfree
-
curl_formget (atom, atom, atom)
Serialize a curl_httppost struct built with curl_formadd().
Params:
-
atom form
-
atom arg
-
atom app
curl_formget_callback
Description:
Accepts a void pointer as second argument which will be passed to
the curl_formget_callback global function.
Return:
Returns 0 on success.
-
curl_getenv (sequence)
Params:
Description:
DEPRECATED
Example:
puts(1, curl_getenv("SystemRoot") & "\n")
C:\WINDOWS
-
curl_version ()
Returns a static ascii string of the libcurl version.
Example:
puts(1, curl_version() & "\n")
libcurl/7.50.3 WinSSL zlib/1.2.8
-
curl_easy_escape (atom, sequence)
Escapes URL strings
Params:
-
atom handle
-
sequence string
Description:
Converts all letters consider illegal in URLs to their %XX versions
Return:
Returns a new allocated string or NULL if an error occurred.
Example:
request = "https://www.google.fr/search?q=élégant"
puts(1, curl_easy_escape(curl, request) & "\n")
https%3A%2F%2Fwww.google.fr%2Fsearch%3Fq%3D%E9l%E9gant
-
curl_escape (sequence)
Params:
Description:
the previous version
Example:
request = "https://www.google.fr/search?q=élégant"
puts(1, curl_escape(request) & "\n")
https%3A%2F%2Fwww.google.fr%2Fsearch%3Fq%3D%E9l%E9gant
-
curl_easy_unescape (atom, sequence)
Unescapes URL encoding in strings
Params:
-
atom handle
-
sequence string
Description:
Converts all %XX codes to their 8bit versions.
Conversion Note: On non-ASCII platforms the ASCII %XX codes are
converted into the host encoding.
Return:
Returns a new allocated string or NULL if an error occurred.
Example:
s = "https%3A%2F%2Fwww.google.fr%2Fsearch%3Fq%3D%E9l%E9gant"
puts(f_debug, curl_easy_unescape(curl, s) & "\n")
https://www.google.fr/search?q=élégant (utf-8)
-
curl_unescape (sequence)
Params:
Description:
the previous version
Example:
s = "https%3A%2F%2Fwww.google.fr%2Fsearch%3Fq%3D%E9l%E9gant"
puts(f_debug, curl_easy_unescape(curl, s) & "\n")
https://www.google.fr/search?q=élégant (utf-8)
-
curl_global_init (atom)
Params:
Description:
curl_global_init() should be invoked exactly once for each application that
uses libcurl and before any call of other libcurl functions.
This global function is not thread-safe!
Example:
res = curl_global_init(CURL_GLOBAL_DEFAULT)
-
curl_slist_append (atom, sequence)
Appends a string to a linked list.
Params:
-
atom slist
-
sequence string
Description:
If no list exists, it will be created first.
Return:
Returns the new list, after appending.
Example:
slist = curl_slist_append(NULL, "toto")
slist = curl_slist_append(slist, "titi")
-
peek_curl_slist (atom, integer)
return the content of a slist as a sequence
Params:
Example:
slist = curl_slist_append(NULL, "toto")
slist = curl_slist_append(slist, "titi")
slist = curl_slist_append(slist, "tata")
analyze_object(peek_curl_slist(slist, -1), "slist", {})
slist =
. [1] "toto"
. [2] "titi"
. [3] "tata"
-
curl_getdate (sequence)
Params:
Description:
Returns the time, in seconds since 1 Jan 1970 of the time string given in
the first argument. The time argument in the second parameter is unused
and should be set to NULL.
-
curl_version_info ()
returns a pointer to a static copy of the version info struct.
-
curl_easy_strerror (integer)
turns a CURLcode value into the equivalent human readable error string.
Params:
Description:
This is useful for printing meaningful error messages.
-
curl_easy_pause (atom, integer)
pauses or unpauses transfers.
Params:
-
atom handle
-
integer bitmask
Description:
Select the new state by setting the bitmask, use the convenience defines.
-
curl_easy_init ()
Example:
curl = curl_easy_init()
if curl then
-- do some stuff
end if
-
curl_easy_perform (atom)
Params:
Example:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP)
curl_easy_setopt(curl, CURLOPT_PROXY, "")
curl_easy_setopt(curl, CURLOPT_RESOLVE, "example.com")
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com")
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1)
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1)
res = curl_easy_perform(curl)
if (res != CURLE_OK) then
printf(2, "curl_easy_perform() failed: %s\n",
{curl_easy_strerror(res)})
else
puts(1, "curl_easy_perform() succeeded\n")
end if
-
curl_easy_getinfo (atom, integer)
request internal information from the curl session
Params:
Description:
Intended to get used *AFTER* a performed transfer.
All results from this global function are undefined until the
transfer is completed.
Return:
requested data or -1 on error
Example:
res = curl_easy_perform_ex(curl)
cookies = curl_easy_getinfo(curl, CURLINFO_COOKIELIST)
if not length(cookies) then
puts(1, "(none)\n")
else
for i = 1 to length(cookies) do
s = split(cookies[i], "\t", {})
printf(1, "[%d]: %s = %s\n", {i, s[6], s[7]})
end for
end if
-
curl_easy_duphandle (atom)
Params:
Description:
Creates a new curl session handle with the same options set for the handle
passed in. Duplicating a handle could only be a matter of cloning data and
options, internal state info and things like persistent connections cannot
be transferred. It is useful in multithreaded applications when you can run
curl_easy_duphandle() for each new thread to avoid a series of identical
curl_easy_setopt() invokes in every thread.
-
curl_easy_recv (atom, atom, integer)
Params:
-
atom curl
-
atom buffer
-
integer buflen
Description:
Receives data from the connected socket. Use after successful
curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
-
curl_easy_send (atom, atom, integer)
Params:
-
atom curl
-
atom buffer
-
integer buflen
Description:
Sends data over the connected socket. Use after successful
curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
-
curl_extract_cookies (sequence, sequence)
extract cookies from sequence of headers
Params:
Description:
option raw defaults to no (only cookie name and value returned)
only last header is considered in case of redirection
Return:
sequence
list of cookies found in last header
Example:
res = curl_easy_perform_ex(curl)
cookies = curl_extract_cookies(res[3], {{"raw", 1}})
analyze_object(cookies, "cookies", {})
cookies = curl_extract_cookies(res[3], {})
analyze_object(cookies, "cookies", {{"output", f_debug}})
-
curl_extract_csrf_token (sequence)
extract CSRF token from HTML content
Params:
-
sequence content
HTML content
Return:
sequence
* CRSF token
Example:
res = curl_easy_perform_ex(curl)
token = curl_extract_csrf_token(res[4])
-
curl_easy_perform_ex (atom)
gets a page
Params:
-
atom handle
CURL session handle
Description:
in case of redirection, if CURLOPT_FOLLOWLOCATION is set, there may be many
headers and URL returned may be different than original URL
Return:
sequence
* status : HTTP status
* url : effective URL (useful if redirection is followed)
* headers : sequence of headers
* content : HTML Page content
Example:
curl_easy_setopt(curl, CURLOPT_URL, "https://edf-70ans.r1a.eu/landing")
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0)
res = curl_easy_perform_ex(curl)
printf(1, "Status: %d\n", {res[1]})
printf(1, "Effective URL: %s\n", {res[2]})
analyze_object(res[3], "Headers", {{"output", f_debug}})
analyze_object(res[4], "Content", {{"output", f_debug}})
See also:
curl_easy_perform
-
curl_get (atom, sequence, sequence)
sends a GET request to an URL and gets the page
Params:
-
atom handle
CURL session handle
-
sequence url
URL to get the page from
-
sequence headers
list of request headers
Description:
intended to be used with REST APIs
Return:
sequence
* status : HTTP status
* url : effective URL (useful if redirection is followed)
* headers : sequence of headers
* content : HTML Page content
Example:
constant DEFAULT_HEADERS = {
"Host: 192.168.1.10",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0 " &
"Gecko/20100101 Firefox/45.0",
"Accept: application/json"
}
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0)
res = curl_get(curl, "https://edf-70ans.r1a.eu/landing", DEFAULT_HEADERS)
printf(1, "Status: %d\n", {res[1]})
printf(1, "Effective URL: %s\n", {res[2]})
analyze_object(res[3], "Headers", f_debug)
analyze_object(res[4], "Content", f_debug)
See also:
curl_easy_perform, curl_post, curl_put, curl_delete, curl_patch
-
curl_post (atom, sequence, sequence, object)
sends a POST request to an URL and gets the page
Params:
Description:
intended to be used with REST APIs
Return:
sequence
* status : HTTP status
* url : effective URL (useful if redirection is followed)
* headers : sequence of headers
* content : HTML Page content
Example:
constant DEFAULT_HEADERS = {
"Host: 192.168.1.10",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0 " &
"Gecko/20100101 Firefox/45.0",
"Accept: application/json"
}
object res = curl_post(curl, MY_REST_API & "/session/" & sessionId &
"/timeouts/implicit_wait", DEFAULT_HEADERS, "{" &
"\"sessionId\": \"" & sessionId & "\", " &
sprintf("\"ms\": %d", ms) &
"}")
printf(1, "Status: %d\n", {res[1]})
printf(1, "Effective URL: %s\n", {res[2]})
analyze_object(res[3], "Headers", f_debug)
analyze_object(res[4], "Content", f_debug)
See also:
curl_easy_perform, curl_easy_perform_ex, curl_get, curl_put, curl_delete, curl_patch
-
curl_put (atom, sequence, sequence, object)
sends a PUT request to an URL and gets the page
Params:
Description:
intended to be used with REST APIs
Return:
sequence
* status : HTTP status
* url : effective URL (useful if redirection is followed)
* headers : sequence of headers
* content : HTML Page content
Example:
constant DEFAULT_HEADERS = {
"Host: 192.168.1.10",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0 " &
"Gecko/20100101 Firefox/45.0",
"Accept: application/json"
}
object res = curl_put(curl, MY_REST_API & "/session/" & sessionId &
"/timeouts/implicit_wait", DEFAULT_HEADERS, "{" &
"\"sessionId\": \"" & sessionId & "\", " &
sprintf("\"ms\": %d", ms) &
"}")
printf(1, "Status: %d\n", {res[1]})
printf(1, "Effective URL: %s\n", {res[2]})
analyze_object(res[3], "Headers", f_debug)
analyze_object(res[4], "Content", f_debug)
See also:
curl_easy_perform, curl_easy_perform_ex, curl_get, curl_post, curl_delete, curl_patch
-
curl_delete (atom, sequence, sequence)
sends a DELETE request to an URL and gets the page
Params:
-
atom handle
CURL session handle
-
sequence url
URL to get the page from
-
sequence headers
list of request headers
Description:
intended to be used with REST APIs
Return:
sequence
* status : HTTP status
* url : effective URL (useful if redirection is followed)
* headers : sequence of headers
* content : HTML Page content
Example:
constant DEFAULT_HEADERS = {
"Host: 192.168.1.10",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0 " &
"Gecko/20100101 Firefox/45.0",
"Accept: application/json"
}
object res = curl_delete(curl, MY_REST_API & "/session/" & sessionId,
DEFAULT_HEADERS)
See also:
curl_easy_perform, curl_easy_perform_ex, curl_post, curl_put, curl_get, curl_patch
-
curl_delete (atom, sequence, sequence, object)
sends a PATCH request to an URL and gets the page
Params:
Description:
intended to be used with REST APIs
Return:
sequence
* status : HTTP status
* url : effective URL (useful if redirection is followed)
* headers : sequence of headers
* content : HTML Page content
Example:
constant DEFAULT_HEADERS = {
"Host: 192.168.1.10",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0 " &
"Gecko/20100101 Firefox/45.0",
"Accept: application/json"
}
object res = curl_patch(curl, MY_REST_API & "/session/" & sessionId,
DEFAULT_HEADERS & {"Content-Type: application/json"},
{" \"active" : \"false\" "})
See also:
curl_easy_perform, curl_easy_perform_ex, curl_get, curl_post, curl_put, curl_delete