Modules/cURL/curl escape: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{ModuleFunction|cURL}} Closes the curl engine. ==Syntax== <syntaxhighlight lang="lua"> curl_escape(curl handler, string url) </syntaxhighlight> ==Required arguments== * '''curl''' The curl ha...")
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{ModuleFunction|cURL}}
{{ModuleFunction|cURL}}
Closes the curl engine.
Escape url's. You wont need this function if you pass the url to curl_init.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
curl_escape(curl handler, string url)
curlEscape(curl handler, string url)
</syntaxhighlight>
</syntaxhighlight>


Line 17: Line 17:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
curl = curl_init();
curl = curlInit();
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_URL, curl_escape(curl, "http://mtasa.com/"));
     curlSetopt(curl, CURLOPT_URL, curlEscape(curl, "http://mtasa.com/"));
     curl_close(curl);
     curlClose(curl);
end
end
</syntaxhighlight>
</syntaxhighlight>
Line 29: Line 29:
==See also==
==See also==
{{Modules/cURL/functions}}
{{Modules/cURL/functions}}
[[Category:Modules]]

Latest revision as of 11:10, 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.

Escape url's. You wont need this function if you pass the url to curl_init.

Syntax

curlEscape(curl handler, string url)

Required arguments

  • curl The curl handler
  • url The url you want to escape

Returns

The escaped url, if it fails it will return nil

Example

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


See also