X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=node_modules%2Fphantomjs-prebuilt%2Flib%2Fphantom%2Fexamples%2Fopenurlwithproxy.js;fp=node_modules%2Fphantomjs-prebuilt%2Flib%2Fphantom%2Fexamples%2Fopenurlwithproxy.js;h=30b6ffd42a79be0995e60a4b80fb9ad9077f17a3;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/node_modules/phantomjs-prebuilt/lib/phantom/examples/openurlwithproxy.js b/node_modules/phantomjs-prebuilt/lib/phantom/examples/openurlwithproxy.js new file mode 100644 index 000000000..30b6ffd42 --- /dev/null +++ b/node_modules/phantomjs-prebuilt/lib/phantom/examples/openurlwithproxy.js @@ -0,0 +1,25 @@ +"use strict"; +var page = require('webpage').create(), + system = require('system'), + host, port, address; + +if (system.args.length < 4) { + console.log('Usage: openurlwithproxy.js '); + phantom.exit(1); +} else { + host = system.args[1]; + port = system.args[2]; + address = system.args[3]; + phantom.setProxy(host, port, 'manual', '', ''); + page.open(address, function (status) { + if (status !== 'success') { + console.log('FAIL to load the address "' + + address + '" using proxy "' + host + ':' + port + '"'); + } else { + console.log('Page title is ' + page.evaluate(function () { + return document.title; + })); + } + phantom.exit(); + }); +}