0

I want to print the following xml file on my console:

https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml

This is the script i use:

var page = require("webpage").create(),
url = "https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml";

function onPageReady() {
var htmlContent = page.evaluate(function () {
    return document.documentElement.outerHTML;
});

console.log(htmlContent);

phantom.exit();
}

page.open(url, function (status) {
function checkReadyState() {
    setTimeout(function () {
        var readyState = page.evaluate(function () {
            return document.readyState;
        });

        if ("complete" === readyState) {
            onPageReady();
        } else {
            checkReadyState();
        }
    });
}

checkReadyState();
});

And this is the output I get:

<html><head></head><body></body></html>

Then i change the url to http://www.google.com it works fine. Any idea what i have missed?

Helyx
  • 329
  • 1
  • 5
  • 17
  • What PhantomJS do you use? Please register to the `onConsoleMessage`, `onError`, `onResourceError`, `onResourceTimeout` events ([Example](https://gist.github.com/artjomb/4cf43d16ce50d8674fdf)). Maybe there are errors. – Artjom B. Sep 18 '15 at 12:10
  • I'm using 1.9. This i my Output: Unable to load resource (#undefinedURL:https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml) Error code: 6. Description: SSL handshake failed Status: fail – Helyx Sep 18 '15 at 12:14
  • But I started the script with the "--ignore-ssl-errors=yes" argument – Helyx Sep 18 '15 at 12:15
  • possible duplicate of [PhantomJS failing to open HTTPS site](http://stackoverflow.com/questions/12021578/phantomjs-failing-to-open-https-site) – Artjom B. Sep 18 '15 at 12:34
  • POODLE problem is probably at work here (see [this answer](http://stackoverflow.com/a/26417660/1816580)). Also, PhantomJS 1.9.8 is really old. You probably should update to 1.9.7/1.9.8 or 2.0.0 – Artjom B. Sep 18 '15 at 12:35
  • i tried to upgrad phantomjs serval times but after the installation phantomjs -v always returns "1.9.0" I used the .zip file from http://phantomjs.org/download.html – Helyx Sep 18 '15 at 13:22

0 Answers0