Difference between revisions of "Http.request"
From ComputerCraft Wiki
(Fixed example -- http://www.computercraft.info/forums2/index.php?/topic/3467-) |
(Add local variables) |
||
Line 10: | Line 10: | ||
|desc=Prints the code of a loading bar program if successful. | |desc=Prints the code of a loading bar program if successful. | ||
|code=http.request("http://pastebin.com/raw.php?i=Tk19jv43")<br /> | |code=http.request("http://pastebin.com/raw.php?i=Tk19jv43")<br /> | ||
− | requesting = true<br /> | + | local requesting = true<br /> |
while requesting do<br /> | while requesting do<br /> | ||
local event, url, sourceText = os.pullEvent()<br /> | local event, url, sourceText = os.pullEvent()<br /> | ||
if event == "http_success" then<br /> | if event == "http_success" then<br /> | ||
− | respondedText = sourceText.readAll()<br /> | + | local respondedText = sourceText.readAll()<br /> |
print(respondedText)<br /> | print(respondedText)<br /> | ||
requesting = false<br /> | requesting = false<br /> |
Revision as of 03:32, 17 September 2012
Function http.request | |
Sends a HTTP request to the website. Returns event "http_success" on success. | |
Syntax | http.request() |
Returns | event "http_success" on success. |
Part of | ComputerCraft |
API | http |
Examples
Example | |
Prints the code of a loading bar program if successful. | |
Code |
http.request("http://pastebin.com/raw.php?i=Tk19jv43") |