Try disabling the web security by using the command-line option --web-security=no
when running your script. (phantomjs --web-security=no yourscript.js
)
From the PhantomJS reference (http://phantomjs.org/api/command-line.html):
“--web-security=[true|false]
enables web security and forbids cross-domain XHR (default is true). Also accepted: [yes|no]