Phantomjs与Facebook的连接无法进行SSL握手

sam*_*m_c 4 javascript ssl facebook phantomjs

我正在尝试使用phantomjs为Facebook构建一个Web scraper.由于SSL握手失败,连接失败.我得到了相同的结果,但谷歌工作正常.有谁知道这方面的解决方案?我正在运行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();

});
Run Code Online (Sandbox Code Playgroud)

输出:

unable to load url: "https://www.facebook.com/"
error code: 6, description: SSL handshake failed
status: fail
Error opening url "undefined": undefined
Run Code Online (Sandbox Code Playgroud)

Ste*_*ich 5

使用https时,phantomjs默认为SSL 3.0.由于SSL 3.0在大量主机上被禁用,因为它不安全,因此SSL握手将失败.使用phantomjs --ssl-protocol=any使phantomjs用更现代的版本(TLS 1.0或更高版本).