代理在phantomjs [英] Proxy in phantomjs
问题描述
我无法理解如何在phantomjs中使用代理,我试过
I cant understand how to using proxies in phantomjs, i tried
phantomjs example.js --proxy =ip:port
phantomjs example.js --proxy="ip:port"
phantomjs example.js --proxy = ip:port
phantomjs example.js --proxy=ip:port
phantomjs example.js --proxy = ip:port --proxy-type = http
phantomjs example.js --proxy=ip:port --proxy-type=http
但我只看到我的ip =(
but i see only my ip=(
没有任何输出,如果代理ip apriori无效。
No any output, also if proxy ip apriori invalid.
example.js:
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://whoer.net/");
我忘记了什么明显的事情?
谢谢。
what obvious thing i forgot? Thanks.
推荐答案
正如我所说,我忘记了一个显而易见的事情 - phantomjs的论点必须在com之后命令phantomjs不在脚本名称之后。正确的变体:
As i said i forgot one obvious thing - arguments for phantomjs must be after command "phantomjs" not after script name. Correct variant:
phantomjs --proxy = ip:port example.js
phantomjs --proxy=ip:port example.js
这篇关于代理在phantomjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!