与 Facebook 的 Phantomjs 连接失败 SSL 握手
Phantomjs connection to Facebook fails SSL handshake
我正在尝试使用 phantomjs 为 Facebook 构建网络抓取工具。由于 SSL 握手失败,连接失败。我在 Twitter 上得到了相同的结果,但 google 工作正常。有谁知道这个的解决方案?我是 运行 phantomjs 版本 1.9.7。我在下面发布了我的代码和错误输出。
var system = require('system');
var page = require('webpage').create();
page.open('https://www.facebook.com', function(status){
console.log("status: " + status);
if(status === "success"){
console.log("no error");
} else {
console.log("Error opening url \"" + page.reason_url + "\": " + page.reason);
}
phantom.exit();
});
输出:
unable to load url: "https://www.facebook.com/"
error code: 6, description: SSL handshake failed
status: fail
Error opening url "undefined": undefined
phantomjs 在使用 https 时默认为 SSL 3.0。由于 SSL 3.0 因不安全而在许多主机上被禁用,因此 SSL 握手将失败。使用 phantomjs --ssl-protocol=any
让 phantomjs 使用更现代的版本(TLS1.0 或更高版本)。
我正在尝试使用 phantomjs 为 Facebook 构建网络抓取工具。由于 SSL 握手失败,连接失败。我在 Twitter 上得到了相同的结果,但 google 工作正常。有谁知道这个的解决方案?我是 运行 phantomjs 版本 1.9.7。我在下面发布了我的代码和错误输出。
var system = require('system');
var page = require('webpage').create();
page.open('https://www.facebook.com', function(status){
console.log("status: " + status);
if(status === "success"){
console.log("no error");
} else {
console.log("Error opening url \"" + page.reason_url + "\": " + page.reason);
}
phantom.exit();
});
输出:
unable to load url: "https://www.facebook.com/"
error code: 6, description: SSL handshake failed
status: fail
Error opening url "undefined": undefined
phantomjs 在使用 https 时默认为 SSL 3.0。由于 SSL 3.0 因不安全而在许多主机上被禁用,因此 SSL 握手将失败。使用 phantomjs --ssl-protocol=any
让 phantomjs 使用更现代的版本(TLS1.0 或更高版本)。