Skip to content

Instantly share code, notes, and snippets.

@FunkyAss
Created May 23, 2014 19:57
Show Gist options
  • Save FunkyAss/c73715fc1acadb858899 to your computer and use it in GitHub Desktop.
Save FunkyAss/c73715fc1acadb858899 to your computer and use it in GitHub Desktop.
lua-curl, f307002585af28234a5517bbd5fb69637c82e90f. full example
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