rcurl

posting data using xml with R

孤街浪徒 提交于 2020-02-23 08:30:06
问题 I want to post xml with R, the code in python is import urllib2 url = 'http://www.rcsb.org/pdb/rest/search' queryText = """ <?xml version="1.0" encoding="UTF-8"?> <orgPdbQuery> <version>B0907</version> <queryType>org.pdb.query.simple.ExpTypeQuery</queryType> <description>Experimental Method Search : Experimental Method=SOLID-STATE NMR</description> <mvStructure.expMethod.value>SOLID-STATE NMR</mvStructure.expMethod.value> </orgPdbQuery> """ print "query:\n", queryText print "querying PDB...\n

Why url.exists returns FALSE when the URL does exists using RCurl?

偶尔善良 提交于 2020-01-25 21:42:08
问题 For example: if(url.exists("http://www.google.com")) { # Two ways to submit a query to google. Searching for RCurl getURL("http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=RCurl&btnG=Search") # Here we let getForm do the hard work of combining the names and values. getForm("http://www.google.com/search", hl="en", lr="",ie="ISO-8859-1", q="RCurl", btnG="Search") # And here if we already have the parameters as a list/vector. getForm("http://www.google.com/search", .params = c(hl="en", lr=

R packages: RCurl and curl packages install failure on Linux

雨燕双飞 提交于 2020-01-23 07:27:33
问题 I hope you can help with this issue I have come across whilst installing RCurl and curl packages for R. Rd warning: /tmp/RtmpOBkvFC/R.INSTALLd07e6c06faf4/RCurl/man/url.exists.Rd:5: missing file link ‘file.exists’ ** building package indices ** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl/libs/RCurl.so': /lib64/libgssapi_krb5.so.2: symbol krb5int_buf_len,

Scraping data off of NBA.com

旧街凉风 提交于 2020-01-22 16:59:46
问题 I'm trying to scrape data off roster data from http://stats.nba.com/team/#!/1610612742/. So far, I've tried RCurl and XML packages and the code I'v tried is as follows: library(RCurl) library(XML) webpage <- getURL("http://stats.nba.com/team/#!/1610612742/") webpage <- readLines(tc <- textConnection(webpage)); pagetree <- htmlTreeParse(webpage, useInternalNodes = TRUE) x <- unlist(xpathApply(pagetree,"//*nba-stat-table_overflow/player",xmlValue)) Content <- gsub(pattern = "([\t\n])",

How do I get extract a table from an HTML Page as a data.frame using XML and Rcurl in R [closed]

与世无争的帅哥 提交于 2020-01-17 14:09:09
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I need to extract a table as a data.frame from the following HTML Page: https://www.forbes.com/powerful-brands/list/#tab:rank.html 回答1: That table has live content, so you need a headless browser, Rselenium should be your first choice. Also, you need rvest to extract the table

R and xpathApply — removing duplicates from nested html tags

和自甴很熟 提交于 2020-01-17 04:55:14
问题 I have edited the question for brevity and clarity My goal is to find and XPath expression that will result in "test1"..."test8" listed separately. I am working with xpathApply to extract text from web pages. Due to the layout of various different pages that information will be pulled from, I need to extract the XML values from all <font> and <p> html tags. The problem I run into is when one type is nested within the other, resulting in partial duplicates when I use the following xpathApply

Upload csv file to REST API with R

こ雲淡風輕ζ 提交于 2020-01-15 19:31:27
问题 I want to upload a csv file to a REST API. The API is accessible via an URL like http://sampledomain.com/api/data/?key=xxx A provided sample curl call looks as following: curl --form "file=@my_data.zip" \ "http://sampledomain.com/api/data/?key=xxx" How can I translate this call into R? I heard of the RCurl package, but can´t figure out how to use it in this case. Regards 回答1: I am not sure RCurl will handle it as you can see from the limit on the first page. Limitations One doesn't yet have

Trying to download Google Trends data but date parameter is ignored?

纵然是瞬间 提交于 2020-01-13 04:29:25
问题 I am trying to download Google Trends data in csv format. For basic queries I have been successful (following a blog post by Christoph Riedl). Problem : By default trends are returned starting from January 2004. I would prefer it to return trends starting from January 2011. However when I add a date parameter to the url request it is completely ignored. I'm not sure how to overcome this. The following is code will reproduce the issue. # Just copy/paste this stuff - these are helper functions

How do I get RCurl to connect to POST SSL on OS X Yosemite?

被刻印的时光 ゝ 提交于 2020-01-05 10:32:38
问题 Since upgrading to OS X Yosemite 10.10.2, I have been unable to use RCurl to send POSTs via SSL. The error message I get is: Error in function (type, msg, asError = TRUE) : SSLRead() return error -9806 This strongly resembles the curl error here: osx 10.10 Curl POST to HTTPS url gives SSLRead() error So I ran the instructions to install libcurl via home-brew, per the answers on that question, but I cannot figure out how to link RCurl to the new libcurl. curl-config still returns the old

RCurl Twitter Streaming API Keyword Filtering

一笑奈何 提交于 2020-01-05 07:29:58
问题 I saw this previous post but I have not been able to adapt the answer to get my code to work. I am trying to filter on the term bruins and need to reference cacert.pem since for authentication on my Windows machine. Lastly, I have written a function to parse each response (my.function) and need to include this as well. postForm("https://stream.twitter.com/1/statuses/sample.json", userpwd="user:pass", cainfo = "cacert.pem", a = "bruins", write=my.function) I am looking to stay completely