在网站上用R登录

时间:2018-08-12 09:50:48

标签: javascript r curl

我尝试使用此代码登录网站

R - posting a login form using RCurl发布登录表单使用rcurl

your.username <- 'six-sigma@six-sigma- consult.com'
your.password <- 'my password'
your.link     <- 'https://login.xing.com/login'

require(SAScii) 
require(RCurl)
require(XML)
agent="Firefox/61.0.1" 
options(RCurlOptions = list(cainfo =    system.file("CurlSSL", "cacert.pem", package = "RCurl")))
curl = getCurlHandle()
curlSetOpt(cookiejar = 'cookies.txt',useragent = agent,followlocation = TRUE,autoreferer = TRUE,curl = curl)

列表参数以传递到网站(从源html中提取)

params <-
      list(
      'userAgent' = agent,
      'screenWidth' = "",
      'screenHeight' = "",
      'flashMajor' = "",
      'flashMinor' = "",
      'flashBuild' = "",
      'flashPatch' = "",
      'redirect' = "",
      'referrer' = your.link,
      'txtEmail' = your.username,
      'txtPassword' = your.password 
     )

登录表格

 html = postForm(your.link, .params = params, curl = curl)
  html

此代码有效,但未显示错误消息。 如何验证登录是否成功?

有人知道关于如何登录网页的不同方法的很好的教程吗?

0 个答案:

没有答案