Modules/cURL/curl setopt: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with '__NOTOC__ {{ModuleFunction|cURL}} Set an curl option. ==Syntax== <syntaxhighlight lang="lua"> curlcode curl_setopt(curl handler, curloption option, bool/number/string value) </syntaxhighlight> ==Require…')
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
curlcode curl_setopt(curl handler, curloption option, bool/number/string value)
curlcode curlSetopt(curl handler, curloption option, bool/number/string value)
</syntaxhighlight>
</syntaxhighlight>


Line 18: Line 18:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
curl = curl_init("http://mtasa.com/");
curl = curlInit("http://mtasa.com/");
if not curl then
if not curl then
     outputDebugString("Can't connect to http://mtasa.com/ with cURL");
     outputDebugString("Can't connect to http://mtasa.com/ with cURL");
else
else
     curl_setopt(curl, CURLOPT_POST, true);
     curlSetopt(curl, CURLOPT_POST, true);
     curl_close(curl);
     curlClose(curl);
end
end
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 11:08, 22 June 2014


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

Set an curl option.

Syntax

curlcode curlSetopt(curl handler, curloption option, bool/number/string value)

Required arguments

  • handler The curl handler.
  • option An curl option, al the options are found here
  • value The value, this can be a string, number or boolean. At the curl option list you can find wich option needs a string, number or boolean.

Returns

Returns a curlcode. Nevermind it for now, i even don't know what it is. But it returns it.

Example

curl = curlInit("http://mtasa.com/");
if not curl then
    outputDebugString("Can't connect to http://mtasa.com/ with cURL");
else
    curlSetopt(curl, CURLOPT_POST, true);
    curlClose(curl);
end


See also