Difference between revisions of "HTTP (API)"

From ComputerCraft Wiki
Jump to: navigation, search
Line 9: Line 9:
 
The HTTP API must be enabled in mod_ComputerCraft.cfg before being used.
 
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 event is fired.
+
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.
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 22:23, 14 April 2012

The HTTP API allows interfacing with websites and downloading from them.

Methods provided by the HTTP API:

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

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" 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.