0

To be blunt, I want to download the contents of https://www.myfxbook.com/statements/2531687/statement.csv

Thing is, when I try to download it into R (base package), the function returns an statement requesting login:

> url = "https://www.myfxbook.com/statements/2531687/statement.csv"
> download.file(url, destfile = "temp")
trying URL 'https://www.myfxbook.com/statements/2531687/statement.csv'
Content type 'text/csv' length unknown
downloaded 48 bytes
> readLines("temp")
[1] "Please login to Myfxbook.com to use this feature"

I tried GET from httr and got the same result:

> GET(url, authenticate(user, pass), content_type("text/csv"), write_disk("temp"))
> readLines("temp")
[1] "Please login to Myfxbook.com to use this feature"

This also failed:

> library(RCurl)
> baseurl = "https://www.myfxbook.com/statements/2531687/statement.csv"
> un = ***** # masked
> pw = ***** # masked
> upw = paste(un, pw, sep = ":")
> webpage = getURL(baseurl, userpwd = upw)
> webpage
[1] "Please login to Myfxbook.com to use this feature"

I have login info, I just don't know how to use it to download the file.

How can I get it done?

Thanks!

Denny Ceccon
  • 145
  • 9

1 Answers1

0

I tried that CSV and I didn't see anything at all. Anyway, this is how you would normally do it (using another example).

library(dplyr)
MyData2 <- read.csv(file="http://www.grex.org/~ev/breweries_geocode.csv", header=TRUE, sep=",")
ASH
  • 20,759
  • 19
  • 87
  • 200
  • I guess you must be logged in to see the contents. Anyway: `baseurl = "https://www.myfxbook.com/statements/2531687/statement.csv"` `library(dplyr)` `data = read.csv(baseurl)` `data` `[1] Please.login.to.Myfxbook.com.to.use.this.feature` – Denny Ceccon Oct 27 '18 at 01:08