FetchRemote: Difference between revisions
Jump to navigation
Jump to search
Fernando187 (talk | contribs) (add legacy) |
Fernando187 (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
This function allows you to post and receive data from HTTP servers. The calls are asynchronous so you do not get an immediate result from the call, instead a callback function you specify is called when the download completes. | This function allows you to post and receive data from HTTP servers. The calls are asynchronous so you do not get an immediate result from the call, instead a callback function you specify is called when the download completes. | ||
If you are using fetchRemote to connect to a PHP script, you can use '''file_get_contents('php://input')''' to read the '''postData''' sent from this function. | |||
{{Note|Client side function only works with the server the player is connected to unless the domain has been accepted with [[requestBrowserDomains]]}} | {{Note|Client side function only works with the server the player is connected to unless the domain has been accepted with [[requestBrowserDomains]]}} | ||
{{ Warning| function won't trigger inside another fetchRemote function }} | {{ Warning| function won't trigger inside another fetchRemote function }} | ||
Line 11: | Line 10: | ||
{{Legacy|legacy/fetchRemote}} | {{Legacy|legacy/fetchRemote}} | ||
{{New items|5.0154|1.5.4-9.11342| | {{New items|5.0154|1.5.4-9.11342| | ||
Line 42: | Line 15: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool fetchRemote ( string URL[, table options ], callback callbackFunction[, table callbackArguments ] ) | bool fetchRemote ( string URL[, table options ], callback callbackFunction[, table callbackArguments ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
Line 78: | Line 51: | ||
==Example== | ==Example== | ||
{{New items|5.0154|1.5.4-9.11413| | {{New items|5.0154|1.5.4-9.11413| | ||
Example sending email via a web service (adopted from examples on https://documentation.mailgun.com/en/latest/user_manual.html) | Example sending email via a web service (adopted from examples on https://documentation.mailgun.com/en/latest/user_manual.html) |
Revision as of 17:45, 7 November 2024
This function allows you to post and receive data from HTTP servers. The calls are asynchronous so you do not get an immediate result from the call, instead a callback function you specify is called when the download completes.
If you are using fetchRemote to connect to a PHP script, you can use file_get_contents('php://input') to read the postData sent from this function.
This page describes the current implementation. For older versions check legacy version | |
Returns
Example
Changelog
Version | Description |
---|
1.3.1-9.04605 | Added connectionAttempts argument |
1.3.2 | Added client side |
1.5.3-9.11270 | Added queueName argument |
1.5.4-9.11342 | Added alternative syntax |
1.5.4-9.11413 | Added formFields |
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo