Difference between revisions of "Http.get"
From ComputerCraft Wiki
(Fix example code and add comments) |
|||
| Line 10: | Line 10: | ||
{{Example | {{Example | ||
|desc=Gets the content of example.com (in HTML) | |desc=Gets the content of example.com (in HTML) | ||
| − | |code=local sExample = http.get("http://example.com/")<br />write(sExample) | + | |code=local sExample = http.get("http://example.com/") --Get contents of page<br />write(sExample.readAll()) --Read and print contents of page<br />sExample.close() --Just in case |
|output=The source of example.com | |output=The source of example.com | ||
}} | }} | ||
}} | }} | ||
Revision as of 17:47, 30 July 2012
| Returns the response of the server on success or nil on failure. | |
| Syntax | http.get(string url) |
| Returns | The response of the server on success or nil on failure. |
| Part of | ComputerCraft |
| API | HTTP |
Examples
| Gets the content of example.com (in HTML) | |
| Code |
local sExample = http.get("http://example.com/") --Get contents of page
|
| Output | The source of example.com |