PhantomJS只输出部分HTML

时间:2015-05-15 12:59:17

标签: javascript php html phantomjs

我正在尝试使用javascript输出获取html,它看起来像这样:

phantomjs.php:

$phantom_script = dirname(__FILE__). '\phantomjs.js';

$response =  exec ('phantomjs ' . $phantom_script);

echo htmlspecialchars($response);

phantomjs.js:

var webPage = require('webpage');
var page = webPage.create();

page.open('http://www.vedur.is/vedur/spar/stadaspar#station=422', function(status) {
    console.log(page.content);
    phantom.exit();
});

结果是:

<img alt="" width="1" height="1" src="http://potency-cnt.teljari.is/potency/potency.php?o=35;p=%2Fvedur%2Fspar%2Fstadaspar;i=1;cv=2;w=1366;h=768;c=32;j=1.5;u=1431693083;z=0;l=en-US;v=0;e=0;sl=0;uid=bfd17714c46187a29d8d512ca6f2040a;chsum=05cd66be9ba63b0fc9104a7e7117e602"></body></html>

但我想得到整个HTML。

0 个答案:

没有答案