Skip to content

Instantly share code, notes, and snippets.

@Breefield
Created September 9, 2012 03:40
Show Gist options
  • Save Breefield/3682440 to your computer and use it in GitHub Desktop.
Save Breefield/3682440 to your computer and use it in GitHub Desktop.
PhantomJS Custom Headers
var page = require('webpage').create();
// User-Agent is supported through page.settings
page.settings.userAgent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25';
// This is how you set other header variables
page.customHeaders = {'Referer': 'localhost'};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment