https://github.com/gadicc/phantomjs-remote
Run phantomjs on a remote server (e.g. if no binary is available locally)
https://github.com/gadicc/phantomjs-remote
Last synced: about 1 year ago
JSON representation
Run phantomjs on a remote server (e.g. if no binary is available locally)
- Host: GitHub
- URL: https://github.com/gadicc/phantomjs-remote
- Owner: gadicc
- Created: 2013-07-07T11:21:49.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-10-29T13:46:40.000Z (over 11 years ago)
- Last Synced: 2025-03-25T02:51:17.560Z (about 1 year ago)
- Language: JavaScript
- Size: 127 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
Awesome Lists containing this project
README
## phantomjs-remote
Run [PhantomJS](http://phantomjs.org/) 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](https://github.com/Obvious/phantomjs).)
This is my first node.js script, go easy on me :)
## Usage
```js
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:
```js
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:
```bash
node phantom-server.js
```
or
```bash
while `true`; do node phantom-server.js ; done
```