Phantomjs connection to Facebook fails SSL handshake [duplicate]

[亡魂溺海] 提交于 2020-01-11 06:04:29

问题


I am trying to build a web scraper for Facebook using phantomjs. The connection fails due to SSL handshake failure. I get the same result for twitter, but google works fine. Does anyone know a solution for this? I am running phantomjs version 1.9.7. I have posted my code and my error output below.

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();

});

output:

unable to load url: "https://www.facebook.com/"
error code: 6, description: SSL handshake failed
status: fail
Error opening url "undefined": undefined

回答1:


phantomjs defaults to SSL 3.0 when using https. Since SSL 3.0 is disabled on lots of hosts because it is insecure, the SSL handshake will fail. Use phantomjs --ssl-protocol=any to make phantomjs use a more modern version (TLS1.0 or higher).



来源:https://stackoverflow.com/questions/29058557/phantomjs-connection-to-facebook-fails-ssl-handshake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!