To use session-wide Zyte Smart Proxy Manager(formerly Crawlera) proxy with PhantomJs or CasperJS provide and --proxy-auth=<API key>: arguments to PhantomJS (CasperJS passes these arguments to PhantomJS).


casperjs|phantomjs --proxy="" --proxy-auth="<API KEY>:''" yourscript.js

When making HTTPS requests, you should provide path to zyte-smartproxy-ca.crt.


phantomjs --ssl-protocol=any --proxy="" --proxy-auth="<API KEY>:''" --ssl-client-certificate-file=/PATH/zyte-smartproxy-ca.crt phantomjs/examples/rasterize.js twitter.jpg

SpookyJS allows you to spawn multiple instances of CasperJS suites, so proxy and proxy-auth arguments should be provided when creating a Spooky object.


var spooky = new Spooky({
child: {
proxy: '',
proxy-auth: '<API key>:'
/* ... */
/* ... */

If it’s preferred that Smart Proxy Manager operated only on specific URLs, they should be wrapped according to Fetch API.

Example in CasperJS:

var casper = require('casper').create();
// always encode url components !
var url_to_crawl = encodeURIComponent(''); // results in
// You can either
// Authenticate session wide:
casper.setHttpAuth('<API key>', '');'' + url_to_crawl);
// or incorporate authentication into the url:'http://<API key>' + url_to_crawl);

casper.then(function(response) {
this.debugHTML(); // print page source