max max - 1 year ago 78
Javascript Question

phantomjs always return page not found on a particular website

im trying to get sport matches resul from this website

but any address from this website that i try i end up with page not found

while it opens in my own browser

here is a sample code

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

page.onConsoleMessage = function(msg) {
}'', function(status) {

page.evaluate(function() {


i dont know how they are blocking phantom js and i've no idea where to start .....

is there anything in phantom js headers that would alert them ?

i'll appreciate any suggestion or advice on how can i solve this

here is that website output

<a href="">
<img src="logo.jpg" />

<div id="main" class="home">
<div id="breadcrumb">
<strong>The page you requested is not available.</strong>
<hr class="hidden">
<div id="col-content">
<h1>Page not found</h1>
<p>This page not exist on!</p>
<div class="break"></div>
<hr class="hidden">
<div id="footer">
<p class="l">Copyright © 2008-12 (v)</p>
<div class="break"></div>

Answer Source

Try changing the user agent using page.settings.userAgent:

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

page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36';


Source: PhantomJS Docs

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download