http.get

From ComputerCraft Wiki
Revision as of 23:14, 5 May 2013 by Hawk777 (Talk | contribs) (Type-templatify, link to handles documentation in API page, deduplicate description, tidy URL in example)

Jump to: navigation, search


Grid Redstone.png  Function http.get
Sends a HTTP GET request to a website, synchronously. Returns when the request completes, successfully or not.
Syntax http.get(string url)
Returns table a handle on success, or nil on failure
Part of ComputerCraft
API HTTP

Examples

Grid paper.png  Example
Gets the content of example.com (in HTML)
Code
local sExample = http.get("http://example.com/") --Get contents of page
write(sExample.readAll()) --Read and print contents of page
sExample.close() --Just in case
Output The source of http://example.com/