0

How can I use R to login to a web site and perform some action? I think the code below is very close, but something seems to be off here.

library(httr)
library(XML)

handle <- handle("http://subscribers.footballguys.com") 
path   <- "amember/login.php"

# fields found in the login form.
login <- list(
  amember_login = "username"
 ,amember_pass  = "password"
 ,amember_redirect_url = 
   "https://www.google.com/accounts/Login"
)

THEN

response <- POST(handle = handle, path = path, body = login)

Any insight into this would be most appreciated.

ASH
  • 20,759
  • 19
  • 87
  • 200
  • 1
    I'm assuming you have seen [this question](https://stackoverflow.com/questions/24723606/scrape-password-protected-website-in-r?rq=1) which seems to be solving the same problem? – Brandon Mar 03 '18 at 06:54
  • Yeah. That works. I think the site was down earlier today when I tried to run this. I couldn't even access it by copying/pasting the URL into my browser. Anyway, it seems to be working now. Thanks. – ASH Mar 03 '18 at 21:03

0 Answers0