Difference between revisions of "HTTP (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(There is no header_table version of the functions in ComputerCraft, This is not LuaSocket!)
m
Line 9: Line 9:
 
!style="background:#EEE" width="*"|Description
 
!style="background:#EEE" width="*"|Description
 
|-
 
|-
| [[http.request]]( url )<br />
+
| [[http.request]]( url, *postData )<br />
 
|  
 
|  
 
|-
 
|-
Line 15: Line 15:
 
|
 
|
 
|-
 
|-
| [[http.post]]( url, data )<br />
+
| [[http.post]]( url, postData )<br />
 +
|
 +
|-
 +
| * = Optional
 
|
 
|
 
|}
 
|}

Revision as of 04:08, 12 July 2012

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.

Methods

Method name Description
http.request( url, *postData )
http.get( url )
http.post( url, postData )
* = Optional

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.