Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Run phantomjs on a remote server (e.g. if no binary is available locally)
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
History.md
README.md
package.json
phantom-client.js
phantom-repl.js
phantom-server.js

README.md

phantomjs-remote

Run PhantomJS scripts on a remote server (e.g. if the phantomjs binary is not available on the local system, like a PaaS virtual machine with an unsupported architecture for phantomjs node wrapper.)

This is my first node.js script, go easy on me :)

Usage

var phantomjs_remote = require('phantomjs-remote');
phantomjs_remote.send(phantomJsScript, callback, [options], [host], [port]).

options is an optional JSON dictionary with any required options, for now only load-images is supported, e.g. { 'load-images': 'no' }.

The last two options may be ommitted if PHANTOMJS_REMOTE environment variable is set with "host:port".

Short example:

phantomjs_remote('console.log(1); phantom.exit();', function(error, result) {
    if (!error)
        console.log(result);
}, { 'load-images': 'no'} );

Server script / SECURITY

You are advised against running this script on it's own and should instead:

  1. Run it in a chroot jail
  2. Firewall the port to only receive connections from trusted hosts

Anyways, run like this:

node phantom-server.js <listenPort>

or

while `true`; do node phantom-server.js <listenPort> ; done 
Something went wrong with that request. Please try again.