Phantomjs连接Facebook失败SSL握手

3

我试图使用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
1个回答

5

当使用https时,phantomjs默认使用SSL 3.0。由于SSL 3.0存在安全问题,许多主机已经禁用了它,因此SSL握手将失败。请使用phantomjs --ssl-protocol=any命令使phantomjs使用更现代的版本(TLS1.0或更高版本)。


这可以帮我登录Facebook... https://www.facebook.com/login.php - DarckBlezzer

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接