[英]Dynamic Proxy in phantomjs
I tried it 我尝试过这个
phantomjs --proxy=ip:port example.js 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 但我想通过example1.net的代理,只是我不想要example2.net
How can I solve it? 我该如何解决?
PhantomJS has a PhantomJS有一个
setProxy(ip, port [, proxyType = 'http', user, password])
method to do this dynamically. 动态执行此操作的方法。 See https://github.com/ariya/phantomjs/pull/11829 .
请参阅https://github.com/ariya/phantomjs/pull/11829 。 Other proxy type is
socks5
. 其他代理类型是
socks5
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.