rcurl

Get site content over SSL with httr in R

家住魔仙堡 提交于 2019-12-02 05:47:38
I'm trying to fetch a JSON array from my server using the HTTP POST method in R. I've tried using both the POST function from httr and the getURL function from RCurl but both return errors. cafile <- system.file("CurlSSL", "cacert.pem", package = "RCurl") url <- "https://example.com/query/getData.php" POST(url,body=NULL) POST(url,body=NULL,config(cainfo=cafile)) getURL(url) getURL(url,cainfo=cafile) The error given by the POST function is (for both calls): Error in curl::curl_fetch_memory(url, handle = handle) : SSL peer certificate or SSH remote key was not OK The error given by the getURL

Create an remote directory using SFTP / RCurl

十年热恋 提交于 2019-12-02 05:21:12
Is it possible to create a directory on an SFTP site using the RCurl package? I found the sftp_create_dirs function, but I could not find an example how to use it. I tried to set the ftp.create.missing.dirs option to TRUE , as in library(RCurl) opts <- list(ftp.create.missing.dirs=TRUE, ssh.public.keyfile = mypubkey, ssh.private.keyfile = myprivatekey) ftpUpload("myfile.txt", "sftp://me@www.host.org/newdir/myfile.txt", .opts=opts) This works if newdir exists, but fails if it does not exists. Any hint appreciated! 来源: https://stackoverflow.com/questions/20181690/create-an-remote-directory-using

Invalid 'path' argument with XLConnect

南笙酒味 提交于 2019-12-02 05:20:21
问题 I am trying and failing to get the following process to complete in R Version 3.1.2: library(RCurl) library(XLConnect) yr <- substr(Sys.Date(), 1, 4) mo <- as.character(as.numeric(substr(Sys.Date(), 6, 7)) - 1) temp <- tempfile() temp <- getForm("http://strikemap.clb.org.hk/strikes/api.v4/export", FromYear = "2011", FromMonth = "1", ToYear = yr, ToMonth = mo, `_lang` = "en") CLB <- readWorksheetFromFile(temp, sheet=1) unlink(temp) I have been able manually to export the requested data set and

Invalid 'path' argument with XLConnect

偶尔善良 提交于 2019-12-02 01:25:45
I am trying and failing to get the following process to complete in R Version 3.1.2: library(RCurl) library(XLConnect) yr <- substr(Sys.Date(), 1, 4) mo <- as.character(as.numeric(substr(Sys.Date(), 6, 7)) - 1) temp <- tempfile() temp <- getForm("http://strikemap.clb.org.hk/strikes/api.v4/export", FromYear = "2011", FromMonth = "1", ToYear = yr, ToMonth = mo, `_lang` = "en") CLB <- readWorksheetFromFile(temp, sheet=1) unlink(temp) I have been able manually to export the requested data set and then read it into R from a local directory using the same readWorksheetFromFile syntax. My goal now is

Download a file keeping original filename when final link is hidden

旧巷老猫 提交于 2019-12-01 17:55:48
问题 I need to download a file, save it in a folder while keeping the original filename from the website. url <- "http://www.seg-social.es/prdi00/idcplg?IdcService=GET_FILE&dID=187112&dDocName=197533&allowInterrupt=1" From a web browser, if you click on that link, you get to download an excel file with this filename: AfiliadosMuni-02-2015.xlsx I know I can easily download it with the command download.file in R like this: download.file(url, "test.xlsx", method = "curl") But what I really need for

How to specify certificate, key and root certificate with httr for certificate based authentication?

蓝咒 提交于 2019-12-01 09:17:16
I am trying to access data using httr library from server which expects certificate based authentication. I have certificate (cert.pem), key file (key.pem) and root certificate (caroot.pem) Following curl works. curl -H "userName:sriharsha@rpc.com" --cert cert.pem --key certkey.key --cacert caroot.pem https://api.somedomain.com/api/v1/timeseries/klog?limit=1 How can specify certkey.key and caroot.pem to httr GET request. I am trying with following R command but couldn't find option to specify cert key and caroot. cafile=???? r<-GET(" https://api.somedomain.com/api/v1/timeseries/klog ", query =

Plotting large number of time series using ggplot. Is it possible to speed up?

旧街凉风 提交于 2019-12-01 05:05:55
I am working with thousands of meteorological time series data (Sample data can be downloaded from here) https://dl.dropboxusercontent.com/s/bxioonfzqa4np6y/timeSeries.txt Plotting these data using ggplot2 on my Linux Mint PC (64bit, 8GB RAM, Dual-core 2.6 GHz) took a lot of time. I'm wondering if there is a way to speed it up or a better way to plot these data? Thank you very much in advance for any suggestion! This is the code I'm using for now ############################################################################## #### load required libraries library(RCurl) library(dplyr) library

error setting certificate verify locations, install_github

倾然丶 夕夏残阳落幕 提交于 2019-12-01 04:00:41
I am trying to install a package from github, but I keep getting an error when I use install_github . library(devtools) install_github(repo="swirl", username="ncarchedi") Installing github repo(s) swirl/master from ncarchedi Downloading swirl.zip from https://github.com/ncarchedi/swirl/archive/master.zip Error in function (type, msg, asError = TRUE) : error setting certificate verify locations: CAfile: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RCurl/CurlSSL/cacert.pem CApath: none I have tried to install several different packages (including an updated version of ggmap),

error setting certificate verify locations, install_github

巧了我就是萌 提交于 2019-12-01 01:50:18
问题 I am trying to install a package from github, but I keep getting an error when I use install_github . library(devtools) install_github(repo="swirl", username="ncarchedi") Installing github repo(s) swirl/master from ncarchedi Downloading swirl.zip from https://github.com/ncarchedi/swirl/archive/master.zip Error in function (type, msg, asError = TRUE) : error setting certificate verify locations: CAfile: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RCurl/CurlSSL/cacert.pem

Password SSH authentication method in RCurl

时光总嘲笑我的痴心妄想 提交于 2019-12-01 01:07:49
I'm using the ftpUpload function in the RCurl package to upload files to an sftp file server. I'm having difficulty working out the authentication call. Below is my call: ftpUpload(what = "some-file.png", to = "sftp://some-ftp-server.com:22/path/to/some-file.png", verbose = TRUE, userpwd = "my_userid:my_password") As a result I get: * About to connect() to some-ftp-server.com port 22 (#0) * Trying some-ftp-server.com... * connected * Connected to some-ftp-server.com (some ip address) port 22 (#0) * SSH authentication methods available: publickey,password * Using ssh public key file /home/.ssh