curlOptions              package:RCurl              R Documentation

_C_o_n_s_t_r_u_c_t_o_r _a_n_d _a_c_c_e_s_s_o_r_s _f_o_r _C_U_R_L_O_p_t_i_o_n_s _o_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     These functions provide a constructor and accessor methods  for
     the (currently S3) class 'CURLOptions'. This class is a way to
     group and manage options settings for CURL. These functions manage
     a named list of options where the names are elements of a fixed.
     Not all elements need be set, but these functions take care of
     expanding names to match the fixed set, while allowing callers to
     use abbreviated/partial names. Names that do not match (via
     'pmatch') will cause an error.

     The set of possible names is given by
     'names(getCurlOptionsConstants())'.

     'mapCurlOptNames' handles the partial matching and expansion of
     the names of the options for all the functions that handle CURL
     options. Currently this uses 'pmatch' to perform the matching and
     so rejects words that are ambiguous, i.e. have multiple matches
     within the set of permissible option names. As a result, "head"
     will match both "header" and "headerfunction". We may change this
     behavior in the future, but we encourage using the full names for
     readability of code if nothing else.

_U_s_a_g_e:

     curlOptions(..., .opts = list())
     getCurlConstants()
     "[<-.CURLOptions"(x, i, value)
     "[[<-.CURLOptions"(x, i, value)

_A_r_g_u_m_e_n_t_s:

     ...: name-value pairs identifying the settings for the options of
          interest.

   .opts: a named list of options, typically a previously created
          'CURLOptions' object. These are merged with the options
          specified in '...'.

       x: a 'CURLOptions' object

       i: the name(s) of the option elements being accessed. These can
          be partial names matching elements in the set of known
          options. Other names will cause an error.

   value: the values to assign to the options identified via 'i'.

_D_e_t_a_i_l_s:

     These functions use 'mapCurlOptNames' to match and hence expand
     the names the callers provide.

_V_a_l_u_e:

     'curlOptions' returns an object of class 'CURLOptions' which is
     simply a named list.

     'getCurlConstants' returns a named vector identifying the names of
     the possible options and their associated values. These values are
     used in the C code and also each integer encodes the type of the
     argument expected by the C code for that option.

_A_u_t_h_o_r(_s):

     Duncan Temple Lang <duncan@wald.ucdavis.edu>

_R_e_f_e_r_e_n_c_e_s:

     Curl homepage <URL: http://curl.haxx.se>

_S_e_e _A_l_s_o:

     'curlPerform' 'curlSetOpt'

_E_x_a_m_p_l_e_s:

      tt = basicTextGatherer()
      myOpts = curlOptions(verbose = TRUE, header = TRUE, writefunc = tt[[1]])

       # note that the names are expanded, e.g. writefunc is now writefunction.
      names(myOpts)

      myOpts[["header"]]

      myOpts[["header"]] <- FALSE

     # Using the abbreviation "hea" is an error as it matches
     # both 
     #  myOpts[["hea"]] <- FALSE

      # Remove the option from the list
      myOpts[["header"]] <- NULL

