Appartement Dupleix Appartement Dupleix - 1 year ago 176
Javascript Question

Can't load json from url with Casper Js -> "Loading resource failed with status=fail"

I am new to casper js and I would like to retrieve a json object from a get request.
The message I get is the following :

Loading resource failed with status=fail:

Here is my code :

var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
pageSettings: {
loadImages: false,
loadPlugins: false,
userAgent: 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36'

casper.start().then(function() {'', {
method: 'get',
headers: {
'Accept': 'application/json'

casper.then(function() {
}); {

I have spent lot of time to understand what was going wrong without any succeed. I have not find other similar problems on stack... meaning I must do something wrong.

Thank you for your help

my configuration (from brew info):

  • casperjs: stable 1.0.4 (bottled), devel 1.1-beta3, HEAD

  • phantomjs: stable 2.0.0 (bottled), HEAD

Answer Source

As suggested by @Artjom B., I used the following command line option --ignore-ssl-errors=trueand the file suceeded in loading the json.