curlSetOpt(RCurl)
curlSetOpt()所属R语言包:RCurl
Set values for the CURL options
CURL选项的设定值
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function allows us to set values for the possible options in the CURL data structure that defines the HTTP request. These options persist across calls in the CURLHandle object.
此功能允许我们设置值定义HTTP请求的的CURL数据结构的可行方案。这些选项坚持CURLHandle对象的不同调用。
用法----------Usage----------
curlSetOpt(..., .opts = list(), curl = getCurlHandle(),
.encoding = integer(), .forceHeaderNames = FALSE,
.isProtected = FALSE)
参数----------Arguments----------
参数:...
a named list of curl options to set after the handle has been created.
卷曲的后处理选项来设置已创建命名列表。
参数:.opts
a named list or CURLOptions object identifying the curl options for the handle.
命名列表或CURLOptions对象确定为抓手卷曲的选项。
参数:curl
the CURLHandle object created earlier via a call to getCurlHandle or dupCurlHandle
CURLHandle对象先前创建的通过调用getCurlHandle或dupCurlHandle
参数:.encoding
an integer or a string that explicitly identifies the encoding of the content that is returned by the HTTP server in its response to our query. The possible strings are "UTF-8" or "ISO-8859-1" and the integers should be specified symbolically as CE_UTF8 and CE_LATIN1. Note that, by default, the package attempts to process the header of the HTTP response to determine the encoding. This argument is used when such information is erroneous and the caller knows the correct encoding.
一个整数或一个字符串,它明确地识别编码的内容所传回的HTTP服务器在回应我们的质疑。可能的字符串是“UTF-8”或“ISO-8859-1和CE_UTF8和CE_LATIN1的符号的整数。需要注意的是,默认情况下,包尝试处理HTTP响应头,以确定编码。使用此参数时,这些信息是错误的,在调用者知道正确的编码。
参数:.forceHeaderNames
a logical value which if TRUE allows the caller to explicitly indicate that the HTTPHEADER option needs to have the names prefixed to the strings. This removes any ambiguity caused by the presence of ':' in the values appearing to be the separator between the name and the value of the name: value pairs of the HTTP header.
一逻辑值,如果TRUE允许主叫方明确表示,HTTPHEADER选项需要有前缀的名称的字符串。这消除了name: value对HTTP头的名称和值之间的分隔符的值所造成的存在“:”在任何含糊之处。
参数:.isProtected
a logical vector (or value that is repeated) specifying which of the values in ... and .opts need to be explicitly protected from garbage collection or not. The basic idea is that we specify FALSE if the value being set for the curl option may be garbage collected before the curl handle is garbage collected. This would leave the curl object in an inconsistent state, referring to an R object (i.e. an R function), which may be used after the R object has been garbage collected.
逻辑向量(或重复值)指定的值...和.opts需要显式垃圾收集或保护。其基本思想是,我们指定FALSE如果该值被设置为卷曲的选项可能是前curl手柄被垃圾回收的垃圾收集。这将使curl对象处于不一致的状态,指的是一个R对象(即R的功能),可用于之后的R对象被垃圾收集。
值----------Value----------
An integer value giving the status of the return. This should be 0 as if there was an error in the libcurl mechiansim, we will throw it there.
的状态返回一个整型值。这应该是0,如果有一个错误的libcurl mechiansim,我们将它扔在那里。
(作者)----------Author(s)----------
Duncan Temple Lang <duncan@wald.ucdavis.edu>
参考文献----------References----------
<h3>See Also</h3> <code>getCurlHandle</code> <code>dupCurlHandle</code>
实例----------Examples----------
if(url.exists("http://www.omegahat.org")) {
curl = getCurlHandle()
# Note the header that extends across two lines with the second line[注意延伸跨过两行与第二行的标头]
# prefixed with white space.[前缀与白的空间。]
curlSetOpt( .opts = list(httpheader = c(Date = "Wed, 1/2/2000 10:01:01",
foo="abc\n extra line"), verbose = TRUE),
curl = curl)
ans = getURL("http://www.omegahat.org", curl = curl)
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|