Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.42k stars 435 forks source link

SSL handshake failed!! #651

Closed arsinawaz closed 7 years ago

arsinawaz commented 7 years ago

Hi,

I am trying to access a URl with self signed ssl, and i get the following response in the errors.

Request { "headers": [ { "name": "Accept", "value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }, { "name": "User-Agent", "value": "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1" } ], "id": 1, "method": "GET", "time": "2016-12-08T08:52:11.918Z", "url": "https://my.url.com" } Unable to load resource (#1URL:https://my.url.com) Error code: 6. Description: SSL handshake failed Response (#1, stage "end"): {"contentType":null,"headers":[],"id":1,"redirectURL":null,"stage":"end","status":null,"statusText":null,"time":"2016-12-08T08:52:11.940Z","url":"https://my.url.com"}

I am trying to pass the following parameters to phantomjs-prebuilt but it doesn't seem to work.

  1. --ssl-protocol=any
  2. --ignore-ssl-errors=yes

in the code below:

`var path = require('path'); var childProcess = require('child_process'); var phantomjs = require('phantomjs-prebuilt'); var binPath = phantomjs.path; var util = require('util');

var childArgs = [ path.join(__dirname, 'phantomexample.js'), '--ssl-protocol=any', '--ignore-ssl-errors=yes', ];

childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) { if(stdout == 1){ console.log('success'); } console.log('here IN SCRIPT '); //console.log(util.inspect(stdout, false, null)); console.log(stdout); });`

I am new to phantomjs. Any kind of help is appreciated.

Thanks in advance.