HTTP API
|
|||||||||||
Determine whether a URL is valid and is whitelisted, meaning the HTTP API can connect to it. | |||||||||||
Syntax | http.checkURL(
|
||||||||||
Returns | boolean true | boolean false, string error | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | http | ||||||||||
See also | http.checkURLAsync | ||||||||||
|
|
|||||||||||
An asynchronous version of http.checkURL. Determines whether a URL is valid and is whitelisted, meaning the HTTP API can connect to it. | |||||||||||
Syntax | http.checkURLAsync(
|
||||||||||
Returns | boolean true | boolean false, string error | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | http | ||||||||||
See also | http.checkURL | ||||||||||
|
|
|||||||||||
Attempt to fetch a webpage, using the same arguments as http.request. This will return the response table or false, an error message and (optionally) a handle with the failing response’s content.
The HTTP API assumes Unicode by default, meaning you may run into issues when fetching binary data. To avoid this, set binary to true. You will have to pass something to headers to set the binary flag, however just passing nil will work fine, e.g. http.get(url, nil, true) . |
|||||||||||
Syntax | http.get(
|
||||||||||
Returns | table response | boolean false, string error[, table response] | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | http | ||||||||||
See also | http.post, http.request | ||||||||||
| |||||||||||
|
|
|||||||||||
Attempt to fetch a webpage using the POST method, using the same arguments as http.request. This will return the response table or false, an error message and (sometimes) a handle with the failing response’s content (specifically, this is included when the actual request succeeded, but the server returned an erroneous HTTP code, e.g. 401: Unauthorized).
The HTTP API assumes Unicode by default, meaning you may run into issues when fetching binary data. To avoid this, set binary to true. You will have to pass something to postData and headers to set the binary flag, e.g. http.post(url, "", nil, true) . |
|||||||||||
Syntax | http.post(
|
||||||||||
Returns | table response | boolean false, string error[, table response] | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | http | ||||||||||
See also | http.get, http.request | ||||||||||
|
|
|||||||||||
Asynchronously submit a HTTP GET request. Unlike http.get and http.post, this will not halt the program flow, which allows it to respond to other events while receiving the HTTP response.
If http_success and http_failure events, which need to be listened for. |
|||||||||||
Syntax | http.request(
|
||||||||||
Returns | nil | ||||||||||
Part of | CC:Tweaked (source) (source) | ||||||||||
API | http | ||||||||||
See also | http.get, http.post | ||||||||||
|
|
|||||||||||
Attempt to establish a WebSocket connection to the given URL. | |||||||||||
Syntax | http.websocket(
|
||||||||||
Returns | table handle | nil, string err | ||||||||||
Part of | CC:Tweaked (source) (source) | ||||||||||
API | http | ||||||||||
See also | http.websocketAsync | ||||||||||
| |||||||||||
|
Http.websocketAsync
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.