Phantomjs与Facebook的连接无法进行SSL握手 [英] Phantomjs connection to Facebook fails SSL handshake

查看:72
本文介绍了Phantomjs与Facebook的连接无法进行SSL握手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用phantomjs为Facebook构建一个Web scraper。由于SSL握手失败,连接失败。我得到了相同的结果,但谷歌工作正常。有谁知道这方面的解决方案?我正在运行phantomjs版本1.9.7。我在下面发布了我的代码和错误输出。

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

});

输出:

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


推荐答案

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

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).

这篇关于Phantomjs与Facebook的连接无法进行SSL握手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆