I tried it
phantomjs --proxy=ip:port example.js
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onLoadFinished = function(status){
if (!status){
console.log('fail');
phantom.exit();
}
page.render("1.png");
phantom.exit();
};
page.open("http://example1.net/");
page.open("http://example2.net/");
but I want to go through proxy for example1.net only I don't want for example2.net
How can I solve it?
PhantomJS has a
setProxy(ip, port [, proxyType = 'http', user, password])
method to do this dynamically. See https://github.com/ariya/phantomjs/pull/11829. Other proxy type is socks5
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With