/usr/share/doc/r-cran-rcurl/examples/cis1.R is in r-cran-rcurl 1.95-4.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | if(FALSE) {
require(RCurl)
require(XML)
#myCurl = getCurlHandle()
#getURL("http://www.statindex.org/CIS/psqlQuery/", cookiejar = "-", curl = myCurl)
#.opts = list(cookie = '_ZopeId="19324353A25Uc.N15jM"', verbose = TRUE))
zopeId = '"39704374A25hoMfuqVU"'
# "39704374A25hoMfuqVU"
mycookie <- '_ZopeId="19324353A25Uc.N15jM"'
CISQuery <- function(author = "Ihaka", title = "", keyword = "",
journal = "", yearbeg = "", yearend = "", format = "bib",
url = "http://www.statindex.org/CIS/psqlQuery/Searcher",
zope = zopeId,
cookie= mycookie){
v <- postForm(url, skip = "+", authed = "+", authed = "a",
authorstring = author, titlestring = title,
keywordstring = keyword, jnt = "jp", jnamestring = journal, pt= "+",
pt = "b", pt = "j", pt = "p", pt = "+",
yearbeg = yearbeg, yearend = yearend,
startDisplay = "1", endDisplay = "50", fmt = format,
.opts = list(cookie = paste('_ZopeId=', zope, sep = ""), verbose = TRUE))
g <- htmlTreeParse(v, asText = TRUE, useInternal = TRUE)
if(length(g["//*[. = 'You are not an authenticated user']"]))
stop("Not an authenticated CIS user")
print(saveXML(g))
x = g[["//body/pre"]]
browser()
h <- h[["pre"]][["text"]]
i <- unlist(strsplit(h$value,"@"))[-1]
j <- gsub("\n+$","",i)
k <- gsub("^","@",j)
l <- sapply(k, function(x) strsplit(x,"\n"),USE.NAMES = FALSE)
lapply(l,function(x) {x; class(x) <- "Bibtex"; x})
}
f <- CISQuery()
}
|