http.checkURL
From ComputerCraft Wiki
Function http.checkURL | |
Validates a URL, checking it is in the correct format and it the website is on the whitelist. If the URL is not valid then the second return value will be an appropriate error message. | |
Syntax | http.checkURL(string url) |
Returns | boolean success, string message |
Part of | ComputerCraft |
API | HTTP |
Examples
Example | |
Validates a URL and errors if it is invalid. | |
Code |
local success, message = http.checkURL("http://example.com") if not success then error("Invalid URL: " .. message) end |
Example | |
Various outputs of http.checkURL. | |
Code |
http.checkURL("http://example.com") -- true http.checkURL("example.com") -- false, URL malformed http.checkURL("ftp://example.com") -- false, URL not http |