Difference between revisions of "HTTP (API)"
From ComputerCraft Wiki
(Updated to API overview v2) |
Pokepal101 (Talk | contribs) (Added summaries for functions) |
||
Line 16: | Line 16: | ||
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[http.request]]( url, *postData )</td> | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[http.request]]( url, *postData )</td> | ||
− | <td style="border-top: solid #C9C9C9 1px; padding: .4em;"> | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sends a HTTP request to a website.</td></tr> |
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[http.get]]( url )</td> | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[http.get]]( url )</td> | ||
− | <td style="border-top: solid #C9C9C9 1px; padding: .4em;"> | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sends a HTTP GET request to a website.</td></tr> |
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[http.post]]( url, postData )</td> | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[http.post]]( url, postData )</td> | ||
− | <td style="border-top: solid #C9C9C9 1px; padding: .4em;"> | + | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sends a HTTP POST request to a website.</td></tr> |
</table> | </table> | ||
Revision as of 22:25, 28 December 2012
This page needs some serious TLC, stat! Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: "A summary is required." need to be replaced. AfterLifeLochie 02:13, 1 December 2012 (MSK)) |
The HTTP API must be enabled in mod_ComputerCraft.cfg before being used. To enable it open .minecraft/config/mod_ComputerCraft.cfg and change enableAPI_http=0 to enableAPI_http=1.
The HTTP API allows interfacing with websites and downloading from them.
Method Name | Description |
http.request( url, *postData ) | Sends a HTTP request to a website. |
http.get( url ) | Sends a HTTP GET request to a website. |
http.post( url, postData ) | Sends a HTTP POST request to a website. |
A period of time after a http.request() call is made, a "http_success" or "http_failure" event will be raised to os.pullEvent(). Arguments are the URL and a file handle if successful. http.get() blocks until this event is fired.