title: Using rvest or httr to log in to non-standard forms on a webpage
body: <p>I am attempting to use rvest to spider a webpage that requires an email/password login on a form.</p>
  
  <pre><code>rm(list=ls())
  library(rvest)
  
  ### Trying to sign into a form using email/password 
  
  url       &lt;-"http://www.perfectgame.org/"   ## page to spider
  pgsession &lt;-html_session(url)               ## create session
  pgform    &lt;-html_form(pgsession)[[1]]       ## pull form from session
  
  set_values(pgform, `ctl00$Header2$HeaderTop1$tbUsername` = "myemail@gmail.com") 
  set_values(pgform, `ctl00$Header2$HeaderTop1$tbPassword` = "mypassword")
  
  submit_form(pgsession,pgform,submit=`ctl00$Header2$HeaderTop1$Button1`)
  </code></pre>
  
  <p>This gives me the following error message:</p>
  
  <pre><code>Error in submit_request(form, submit) : 
  </code></pre>
  
  <p>object 'ctl00$Header2$HeaderTop1$Button1' not found</p>
  
  <p>If I submit the form without specifying the submit parameter, I get this:</p>
  
  <pre><code>Submitting with 'ctl00$Header2$HeaderTop1$Button1'
  Error in function (type, msg, asError = TRUE)  : &lt;url&gt; malformed
  </code></pre>
  
  <p>I also tried passing the parameters directly to httr as mentioned in this question: <a href="https://stackoverflow.com/questions/27631460/how-can-i-post-a-simple-html-form-in-r">How can I POST a simple HTML form in R?</a>, but the "submit" parameter did not accept the submit button either with backwards quotes (``), quotation marks, or without any quotes:</p>
  
  <pre><code>library(httr)
  
  url &lt;- "http://www.perfectgame.org/Rankings/Players/Default.aspx?gyear=2015&amp;num=500"
  
  fd &lt;- list(
      submit = `ctl00$Header2$HeaderTop1$Button1`,
      `ctl00$Header2$HeaderTop1$tbUsername`  = "myemail@gmail.com",
      `ctl00$Header2$HeaderTop1$tbPassword`  = "mypassword")
  
  resp&lt;-POST(url, body=fd, encode="form")
  content(resp) 
  </code></pre>
  
  <p>Any ideas for how I can log in from an R session and spider the data that's behind the login wall?</p>