-
-
Save FunkyAss/c73715fc1acadb858899 to your computer and use it in GitHub Desktop.
lua-curl, f307002585af28234a5517bbd5fb69637c82e90f. full example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| local curl = require 'cURL' | |
| local easy = curl.easy_init() | |
| easy:setopt_url("http://mispelled-domain/") | |
| -- curl_perform will return CURLE_COULDNT_RESOLVE_HOST | |
| pcall(easy.perform, easy, { | |
| writefunction = function(chunk) | |
| -- we're not really interested in the request body | |
| return | |
| end | |
| }) | |
| -- a totally legit url | |
| easy:setopt_url("http://example.com") | |
| easy:perform() |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment