Javascript phantomjs中的代理

Javascript phantomjs中的代理,javascript,phantomjs,Javascript,Phantomjs,我不明白如何在phantomjs中使用代理,我试过了 phantomjs example.js--proxy=“ip:port” phantomjs example.js--proxy=ip:port phantomjs example.js--proxy=ip:port--proxy-type=http 但我只看到我的ip=( 如果代理ip apriori无效,也没有任何输出 example.js: 什么明显的事我忘了? 谢谢。正如我所说的,我忘记了一件显而易见的事情——phantomjs的

我不明白如何在phantomjs中使用代理,我试过了

phantomjs example.js--proxy=“ip:port”

phantomjs example.js--proxy=ip:port

phantomjs example.js--proxy=ip:port--proxy-type=http

但我只看到我的ip=(

如果代理ip apriori无效,也没有任何输出

example.js:

什么明显的事我忘了?
谢谢。

正如我所说的,我忘记了一件显而易见的事情——phantomjs的参数必须在命令“phantomjs”之后,而不是在脚本名称之后。正确的变体:


phantomjs--proxy=ip:port-example.js

此代码用于使用用户名和密码进行身份验证。此外,将结果保存在sample.txt中:


我想值得一提的是,脚本左侧的参数将传递给phantomjs,脚本右侧的参数将传递给脚本本身(可通过
require('system')访问。args
)我在使用«burp»本地代理时遇到问题,并且没有错误消息。您必须设置
--ignore ssl errors=true
(显然,不要在prod中这样做)@A.Méric在生产中加载无效ssl证书的风险是什么?想想废品商、海报或API消费者,他们并不真正需要满足ssl要求,甚至可以使用这些“--ignore ssl errors=true”、“--ssl protocol=any”、“--web security=false”仍然可以在生产中工作。我想你不想说“不要对sensi这样做”tive/private服务。有时,除非您删除SSL警告,否则PhantomJS不会加载。如果您有自己的网站,并且有自动签名的SSL证书,您将收到相同的错误…并且您不能调用这不是生产,因为绕过了您自己的证书。
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/");
phantomjs --proxy=Ip:Port --proxy-auth=User:Pass App.js > sample.txt