Modules/cURL/curl strerror: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{ModuleFunction|cURL}} Returns a string with detailed information of an error. ==Syntax== <syntaxhighlight lang="lua"> curl_strerror(curl handler, CURLcode code) </syntaxhighlight> ==Required...")
 
No edit summary
Line 35: Line 35:
==See also==
==See also==
{{Modules/cURL/functions}}
{{Modules/cURL/functions}}
[[Category:Modules]]

Revision as of 15:41, 16 July 2011


Package-x-generic.png This function is provided by the external module cURL. You must install this module to use this function.

Returns a string with detailed information of an error.

Syntax

curl_strerror(curl handler, CURLcode code)

Required arguments

  • curl The curl handler
  • code The curl code

Returns

The string containing the error, if the code was not found in the system it will return nil

Example

curl = curl_init();
if not curl then
    outputDebugString("Can't connect to http://mtasa.com/ with cURL");
else
    curl_setopt(curl, CURLOPT_URL, curl_escape(curl, "http://mtasa.com/"));
    result = curl_perform(curl, {
        writefunction = function(html)
            -- Hell what should i do with html? :S
        end,
    });
    print(curl_strerror(curl, result)); -- Since we know that mta exists, we sure get the text 'No error.'
    curl_close(curl);
end


See also