lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi.  In   /usr/lib/lua/5.1/   there is a curl module which
presumably is there as a by-product of   aptitude install luarocks

In  it says
   The module interface follows strictly the cURL architecture and is
   very easy to use if the programmer has already experience with cURL.
I really like that dry sense of humour :-)  Fortunately there are
a number of websites around that collect working libcurl examples.

I also found   which is good doc,
but seems out of date; like it mentions and curl.close,
which do not appear in:
  require('curl') ; for x in pairs(curl) do print(x) end
In an ideal world, this might perhaps be updated and linked to
from a 'Doc" button in  ?


P.S.  I've ended up using:
  function wget(url)
    local text = {}
    local function WriteMemoryCallback(s)
        text[#text+1] = s
        return string.len(s)
    local c = curl.easy_init()
    c:setopt(curl.OPT_URL, url)
    c:setopt(curl.OPT_WRITEFUNCTION, WriteMemoryCallback)
    c:setopt(curl.OPT_USERAGENT, "luacurl-agent/1.0")
    return table.concat(text,'')
  end      (03) 6278 9410
"Was der Meister nicht kann,   vermöcht es der Knabe, hätt er
 ihm immer gehorcht?"   Siegfried to Mime, from Act 1 Scene 2