Created
May 20, 2016 12:46
-
-
Save memoryleak/8fccf221e594c5f315d43812961b9ed0 to your computer and use it in GitHub Desktop.
Small script I used for testing LB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
var system = require('system'); | |
var args = system.args; | |
var navigateTo = null; | |
if (args.length === 1) { | |
console.log('Please provide a URL to navigate to.'); | |
phantom.exit() | |
} else { | |
navigateTo = args[1]; | |
} | |
phantom.cookiesEnabled = true; | |
page.cookies = phantom.cookies; | |
page.onResourceReceived = function(response) { | |
for (var i = response.headers.length - 1; i >= 0; i--) { | |
if (response.headers[i].name == 'X-Instance' || response.headers[i].name == 'X-Server') { | |
var logStr = response.headers[i].value + "\t\t(" + response.url + ")"; | |
console.log(logStr); | |
} | |
} | |
}; | |
page.open(navigateTo, function(status) { | |
var cookies = page.cookies; | |
for(var i in cookies) { | |
if(cookies[i].name == "b1P") { | |
console.log(cookies[i].name + '=' + cookies[i].value); | |
} | |
} | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment