我正在尝试从以下网址获取回复: -
http://www.marriott.com/reservation/availabilitySearch.mi?isSearch=false&fromDate=06/25/2017&toDate=06/26/2017&clusterCode=&corporateCode=&groupCode=&numberOfRooms=1&numberOfGuests=1&incentiveType_Number=&incentiveType=false&marriottRewardsNumber=&useRewardsPoints=false&propertyCode=NYCCP
当我在浏览器中打开此网址时,此网址会重定向到: - http://www.marriott.com/reservation/rateListMenu.mi
我得到了所需的输出。但是,当我试图从phantomjs获得resposne我没有得到所需的输出。我使用下面的phantomjs代码: -
var system = require('system');
var webPage = require('webpage');
var page = webPage.create();
var url = system.args[1];
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36';
page.settings.javascriptEnabled = true;
page.settings.loadImages = false;
phantom.cookiesEnabled = true;
phantom.javascriptEnabled = true;
page.viewportSize = {
width: 1280,
height: 720
};
page.open(url, function (status) {
setTimeout(function () {
console.log(page.content)
phantom.exit();
}, 10000);
});
我也试过增加/减少超时值但没有运气。