Skip to content

Instantly share code, notes, and snippets.

@ii0
Forked from Breefield/phantom.js
Created August 22, 2016 06:29
Show Gist options
  • Save ii0/1b280099ccf17c297e2b025184c2a73c to your computer and use it in GitHub Desktop.
Save ii0/1b280099ccf17c297e2b025184c2a73c 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