gpt4 book ai didi

https - PhantomJS 无法打开 HTTPS 站点

转载 作者:行者123 更新时间:2023-12-03 04:46:50 25 4
gpt4 key购买 nike

我使用以下基于 loadspeed.js 示例的代码来打开一个 https://站点,该站点也需要 http 服务器身份验证。

var page = require('webpage').create(), system = require('system'), t, address;

page.settings.userName = 'myusername';
page.settings.password = 'mypassword';

if (system.args.length === 1) {
console.log('Usage: scrape.js <some URL>');
phantom.exit();
} else {
t = Date.now();
address = system.args[1];
page.open(address, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');
} else {
t = Date.now() - t;
console.log('Page title is ' + page.evaluate(function () {
return document.title;
}));
console.log('Loading time ' + t + ' msec');
}
phantom.exit();
});
}

总是无法加载页面。这里可能出了什么问题?安全站点的处理方式是否有所不同?不过,可以从浏览器成功访问该网站。

我现在刚刚开始使用 Phantom,发现它太好了,无法停止使用,尽管我没有继续解决这个问题。

最佳答案

我尝试了 Fred 和 Cameron Tinker 的答案,但只有 --ssl-protocol=any 选项似乎对我有帮助:

phantomjs --ssl-protocol=any test.js

此外,我认为使用 --ssl-protocol=any 应该更安全,因为您仍在使用加密,但是 --ignore-ssl-errors=true > 将忽略(废话)所有 ssl 错误,包括恶意错误。

关于https - PhantomJS 无法打开 HTTPS 站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12021578/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com