title: Retrieve file via PhantomJS - Visible using JSON.stringify
body: <p>Im new to using PhantomJS . </p>
  
  <p>Im using a simple script to capture a URL. I tested with :</p>
  
  <pre><code>page.onResourceReceived = function (response) {
      console.log('Receive ' + JSON.stringify(response, undefined, 4));
  };
  </code></pre>
  
  <p>And i can see in the output , that file is available for receipt. </p>
  
  <pre><code>Receive {
      "contentType": "text/xml; charset=utf-8",
      "headers": [
          {
              "name": "Cache-Control",
              "value": "private"
          },
          {
              "name": "Date",
              "value": "Thu, 16 Feb 2017 10:06:55 GMT"
          },
          {
              "name": "Transfer-Encoding",
              "value": "chunked"
          },
          {
              "name": "Content-Type",
              "value": "text/xml; charset=utf-8"
          },
          {
              "name": "Expires",
              "value": "0"
          },
          {
              "name": "Last-Modified",
              "value": "Thu, 16 Feb 2017 10:07:00 GMT"
          },
          {
              "name": "Content-Disposition",
              "value": "attachment; filename=\"Report.xml\""
          },
          {
              "name": "ID",
              "value": "0000Ld6OtL_7u1Qfy_FCD01OWlC5000^8O"
          },
          {
              "name": "X-Powered-By",
              "value": "Test"
          }
      ],
      "id": 14,
      "redirectURL": null,
      "stage": "end",
      "status": 200,
      "statusText": "OK",
      "time": "2017-02-16T10:07:00.759Z",
      "url": "http://xxx/xxx/xxx"
  }
  </code></pre>
  
  <p>Any ideas how i can capture the file <strong>Report.xml</strong> ? I currently am capturing the html of the page but not the XML file that comes with it.</p>
  
  <p>Cheers!</p>
  
  <p>p.s.
  this is the code im using:</p>
  
  <pre><code>var page = require("webpage").create();
  var homePage = "http://url/report/this%20Report";
  
  page.settings.javascriptEnabled = true;
  page.settings.loadImages =false;
  
  
  //page.open(homePage, function(status){
  //  console.log("status="+status);
  //  console.log("csv: " + page.plainText);
    //phantom.exit();
  //});
  
  page.onResourceRequested = function (request) {
      console.log('Request ' + JSON.stringify(request, undefined, 4));
  };
  page.onResourceReceived = function (response) {
      console.log('Receive ' + JSON.stringify(response, undefined, 4));
  };
  
  page.open(homePage, function (status) {
      if (status !== 'success') {
          console.log('Unable to load the address!');
          phantom.exit();
      } else {
          window.setTimeout(function () {
              console.log("csv: " + page.plainText);
              //page.render(output);
              phantom.exit();
          }, 10000); // Change timeout as required to allow sufficient time
      }
  });
  </code></pre>