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?