http_success event

Occurs when a HTTP request has completed successfully. Fired by a http.request call.

ExampleRequest a page
Requests the example page and prints the result.
Code
<nowiki>
-- Request the example page
http.request("https://example.computercraft.cc")
while true do
  -- Wait for a http_success event.
  local event, url, handle = os.pullEvent("http_success")
  -- If it's for our URL, then print the result.
  if url == "https://example.computercraft.cc" then
    print(handle.readAll())
    handle.close()
  end
end
    </nowiki>
http_success
Event
Returns
  • url : string The URL of the request
  • handle : table A file-handle-like object that contains the contents of the request.

Source CC:Tweaked
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.