我正在尝试使用 phantomjs 为 Facebook 构建一个网络抓取工具。由于 SSL 握手失败,连接失败。我在 Twitter 上得到了相同的结果,但谷歌工作正常。有谁知道这个问题的解决方案?我正在运行 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();
});
output:
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 或更高版本)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)