title: Scraping a web page with Java script using R
body: <p>I am working on a task to get the details from a third party website using technique of data scrape using R.</p>
  
  <p>On manual access,the site is authenticated by our sso of our organization and then it is directed to the relevant website pages.</p>
  
  <p>Please advise if my approach is correct and how can I access the actual website and scrape the javascript contents of the actual website.</p>
  
  <p>Below is the sample code</p>
  
  <p>The first print command output is as follow</p>
  
  <p>1] "This page is used to hold your data while you are being authorized for your request.<BR><BR>You will be forwarded to continue the authorization process. If this does not happen automatically, please click the Continue button below.https://xxxx.com/siteminderagent/SmMakeCookie.ccc?SMSESSION=QUERY&amp;PERSIST=0&amp;TARGET=$SM$http%3a%2f%2falacrity%2e%2ecom%3a8084%2falacrity%2fSecure%2fAlacrityLogin%2ejsp\">\r\n"
  attr(,"Content-Type")
                    charset 
   "text/html" "iso-8859-1"</p>
  
  <p>The second print method gives the error
  Error in function (type, msg, asError = TRUE)  : 
    Failed to connect to myscrapeapp</p>
  
  <pre><code>library(RCurl)
  
  #Set the  browsing links 
  loginurl = "http://sso.something.com"
  dataurl  = "https://myscrapeapp:8084/uview"
  
  pars=list(
    username =myusername,
    password=mypassword
    )
  
   agent="Firefox/38.2.0" 
  
   curl= getCurlHandle()
  
   #post the login information
  
   html=postForm(loginurl, .params = pars, curl=curl)
  
   print(html) 
   html=getURL(dataurl, curl=curl)
  
   print(html)
  </code></pre>