Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CasperJS/PhantomJS在某些站点上无法进行SSL握手,即使使用--SSL protocol=any_Javascript_Ssl_Web Scraping_Phantomjs_Casperjs - Fatal编程技术网

Javascript CasperJS/PhantomJS在某些站点上无法进行SSL握手,即使使用--SSL protocol=any

Javascript CasperJS/PhantomJS在某些站点上无法进行SSL握手,即使使用--SSL protocol=any,javascript,ssl,web-scraping,phantomjs,casperjs,Javascript,Ssl,Web Scraping,Phantomjs,Casperjs,我在CasperJS和SSL方面遇到了一些问题,但是使用--SSL protocol=any总是可以解决这个问题,正如答案中所提到的。在这种情况下,我仍然有问题 我把它放在命令行中: casperjs --ssl-protocol=any --ignore-ssl-errors=true sanity.js 这是sanity.js: var casper = require('casper').create({ verbose: true, logLevel: 'debug'

我在CasperJS和SSL方面遇到了一些问题,但是使用--SSL protocol=any总是可以解决这个问题,正如答案中所提到的。在这种情况下,我仍然有问题

我把它放在命令行中:

casperjs --ssl-protocol=any --ignore-ssl-errors=true sanity.js
这是sanity.js:

 var casper = require('casper').create({
    verbose: true,
    logLevel: 'debug'
});

casper.on("resource.error", function(resourceError){
    console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
    console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
});

casper.start('https://www.google.com/', function() {
    this.echo(this.getTitle());
});

casper.thenOpen('https://www.zazzle.com/lgn/signin', function() {
    this.echo(this.getTitle());
});

casper.run();
第一个URL加载良好。但是,SSL握手在第二次握手中失败。调试输出:

[info] [phantom] Starting...
[info] [phantom] Running suite: 4 steps
[debug] [phantom] opening url: https://www.google.com/, HTTP GET
[debug] [phantom] Navigation requested: url=https://www.google.com/, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://www.google.com/"
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/4 https://www.google.com/ (HTTP 200)
Google
[info] [phantom] Step anonymous 2/4: done in 876ms.
[debug] [phantom] opening url: https://www.zazzle.com/lgn/signin, HTTP GET
[debug] [phantom] Navigation requested: url=https://www.zazzle.com/lgn/signin, type=Other, willNavigate=true, isMainFrame=true
Unable to load resource (#9URL:https://www.zazzle.com/lgn/signin)
Error code: 6. Description: SSL handshake failed
[warning] [phantom] Loading resource failed with status=fail: https://www.zazzle.com/lgn/signin
[info] [phantom] Step anonymous 4/4 https://www.google.com/ (HTTP 0)
Google
[info] [phantom] Step anonymous 4/4: done in 1178ms.
[info] [phantom] Done 4 steps in 1197ms

我正在运行PhantomJS版本1.9.7和CasperJS版本1.1.0-beta3。当谈到SSL的更好之处时,我有点不知所措,但是我很难找到更多的方法来解决这个问题。任何帮助都会很棒

我无法用PhantomJS 1.9.7(包括命令行选项)或2.0.1-dev(没有任何命令行选项)重现您的问题。我只能在省略1.9.7的
--ssl protocol=any
选项时看到错误。感谢您的检查!这很奇怪,我无法让它在我的本地机器(OSX)或服务器(Debian)上运行。我只是在Raspberry Pi上用v1.9.7进行了尝试,它在
--ssl协议=any
选项上运行时没有问题。