Modules/cURL/curl perform: Difference between revisions
Jump to navigation
Jump to search
Mack Varial (talk | contribs) No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
curl_perform(curl handler | curl_perform(curl handler) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Required arguments== | ==Required arguments== | ||
* '''curl''' The curl handler | * '''curl''' The curl handler | ||
==Returns== | ==Returns== | ||
Returns a curl code, if the code is CURLE_OK then your good. Other wise pass this code to curl_strerror, and then you will know what is going on. | Returns a curl code, if the code is CURLE_OK then your good. Other wise pass this code to curl_strerror, and then you will know what is going on. | ||
On a success call it will return the data as a second argument. | |||
==Example== | ==Example== | ||
| Line 34: | Line 22: | ||
else | else | ||
curl_setopt(curl, CURLOPT_URL, curl_escape(curl, "http://mtasa.com/")); | curl_setopt(curl, CURLOPT_URL, curl_escape(curl, "http://mtasa.com/")); | ||
curl_perform(curl | result, data = curl_perform(curl); | ||
if result == CURLE_OK then | |||
print(data) | |||
end | |||
curl_close(curl); | curl_close(curl); | ||
end | end | ||
Revision as of 14:15, 27 May 2013
| This function is provided by the external module cURL. You must install this module to use this function. | |
Let cURL do his work now, by call this function.
Syntax
curl_perform(curl handler)
Required arguments
- curl The curl handler
Returns
Returns a curl code, if the code is CURLE_OK then your good. Other wise pass this code to curl_strerror, and then you will know what is going on. On a success call it will return the data as a second argument.
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, data = curl_perform(curl);
if result == CURLE_OK then
print(data)
end
curl_close(curl);
end