Difference between revisions of "HTTP (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m (moved HTTP to HTTP (API))
Line 1: Line 1:
 
The HTTP API allows interfacing with websites and downloading from them. Due to CraftOS's nature, images cannot be downloaded.
 
The HTTP API allows interfacing with websites and downloading from them. Due to CraftOS's nature, images cannot be downloaded.
  
(Please add a documentation here.)
+
Functions in the HTTP API:
  
 +
* http.request( url )
 +
* http.get( url )
 +
 +
The HTTP API must be enabled in mod_ComputerCraft.cfg before being used.
 +
 +
A period of time after a http.request() call is made, a "http_success" or "http_failure" even will be raised to os.pullEvent(). Arguments are the URL and a file handle if successful. http.get() blocks until this even is fired.
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 06:12, 15 February 2012

The HTTP API allows interfacing with websites and downloading from them. Due to CraftOS's nature, images cannot be downloaded.

Functions in the HTTP API:

  • http.request( url )
  • http.get( url )

The HTTP API must be enabled in mod_ComputerCraft.cfg before being used.

A period of time after a http.request() call is made, a "http_success" or "http_failure" even will be raised to os.pullEvent(). Arguments are the URL and a file handle if successful. http.get() blocks until this even is fired.