Difference between revisions of "HTTP (API)"
From ComputerCraft Wiki
Pokepal101 (Talk | contribs) m (Removed NeedsWork tag. (see previous edit)) |
m (Updated config changes) |
||
Line 1: | Line 1: | ||
:{|class="wikitable" | :{|class="wikitable" | ||
− | | '''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= | + | | '''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=false to enableAPI_http=true.''' |
|} | |} | ||
Revision as of 07:23, 12 March 2013
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=false to enableAPI_http=true.
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.