Name
hurl.Easy -- start a libcurl easy session
Synopsis
handle = hurl.Easy([table])
Function
This function must be the first function to call, and it returns a curl easy handle that you must use as input to other functions in the easy interface. This call must have a corresponding call to easy:Close() when the operation is complete.

The optional table argument allows you to get additional options for the easy object. It is possible to use all options here that can also be get separately using the easy:SetOpt() command. For example, to get #CURLOPT_URL, #CURLOPT_VERBOSE, and #CURLOPT_FOLLOWLOCATION at creation time, just do the following:

 
e = hurl.Easy({URL = "http://www.hollywood-mal.com",
        Verbose = True, FollowLocation = True})

This code does the same as:

 
e = hurl.Easy()
e:SetOpt_URL("http://www.hollywood-mal.com")
e:SetOpt_Verbose(True)
e:SetOpt_FollowLocation(True)

Alternatively, you could also use easy:SetOpt() to get those options, like so:

 
e = hurl.Easy()
e:SetOpt(#CURLOPT_URL, "http://www.hollywood-mal.com")
e:SetOpt(#CURLOPT_VERBOSE, True)
e:SetOpt(#CURLOPT_FOLLOWLOCATION, True)

All of the code snippets above do exactly the same thing.

Inputs
table
optional: table argument containing further options (see above)
Results
handle
curl easy handle

Show TOC