我尝试登录安全(HTTPS)服务器。当我使用互联网浏览器输入用户名和密码时,浏览器会将我发送到与登录屏幕之后的下一个URL对应的网页。当我通过getURL()
输入用户密码时,我很难找到下一个网址。以下是R脚本以及服务器和客户端之间的交换。隐藏的下一个URL在哪里?
library(RCurl)
library(XML)
library(bitops)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
html_form = getURL(url1, userpwd = "my_userID:my_password", verbose = TRUE)
verbose选项在客户端/服务器交换上提供以下日志:
* Hostname was NOT found in DNS cache
* Trying 192.118.93.82...
* Connected to bjm.ordernet.co.il (192.118.93.82) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: C:/Program Files/R/R-3.2.0/library/RCurl/CurlSSL/cacert.pem
* CApath: none
* SSL connection using TLSv1.0 / AES128-SHA
* Server certificate:
* subject: OU=GT38954200; OU=See www.rapidssl.com/resources/cps (c)14; OU=Domain Control Validated - RapidSSL(R); CN=*.ordernet.co.il
* start date: 2014-11-29 21:53:16 GMT
* expire date: 2017-01-31 01:33:56 GMT
* subjectAltName: bjm.ordernet.co.il matched
* issuer: C=US; O=GeoTrust Inc.; CN=RapidSSL SHA256 CA - G3
* SSL certificate verify ok.
* GET /Login.aspx?lang=en-US HTTP/1.1
* Host: bjm.ordernet.co.il
* Accept: */*
* HTTP/1.1 302 Found
* Cache-Control: no-cache
* Pragma: no-cache
* Content-Type: text/html; charset=utf-8
* Expires: -1
* Location: /Logout.aspx?aspxerrorpath=/Login.aspx
* X-AspNet-Version: 4.0.30319
* Set-Cookie: LANG=en-US; expires=Fri, 24-Jul-2015 18:50:55 GMT; path=/
* Set-Cookie: .FMRAUTH1=Ubb1R/LBTivtXIwlo/FwbBb0w4Av8TVjvR9XMCcPsVKl2V3RFizDEnZoqdiN6Zis; path=/
* Set-Cookie: .FMRAUTH2=zve5LoqIhZR7tmL0h6ztFG1chyGqCCxBn8kyUqumGgfZAupZTzwjRVW5D459hgLOYX7kZP73HwMOI0nGW4hktdzrp5X8aqrQ8DXvYMNqPAk=; path=/
* Node: 2
* Date: Wed, 24 Jun 2015 18:50:55 GMT
* Content-Length: 155
* Set-Cookie: BIGipServerJer-Pool-V2=2778245312.20480.0000; path=/
* Set-Cookie: TS0176e599=017770e57706811e1a74d02f40c933078588699851800fa95b7e2d9ab5cef9c90b29384338790f603f7ab7d7265e70d83de27057cf874a94f040693278e3f249610f5e940b3fe48c1073207fe646e08ea53ca44f9951e3be19facd19c146fc095fef78e672; Path=/
* Connection #0 to host bjm.ordernet.co.il left intact
答案 0 :(得分:0)
您正在使用HTTP身份验证设置用户名和密码,而您尝试登录的网站正在使用表单进行登录。它还使用JavaScript来进行登录的POST。如果你想让它工作,你可能最好使用你最喜欢的网络浏览器的开发者模式,登录并在Net选项卡中查看登录期间发布的内容。然后,您可以使用httr
包来发布类似的登录信息。
原始问题的答案是302响应的重定向位于“位置”字段中,但所有操作都要求您再次登录!