代理不适用于 PhantomJS。这可能是什么原因?
Proxy not working with PhantomJS. What could be the reason for this?
我正在尝试通过代理使用 phantomjs
。以下代码创建页面快照,以便我可以验证代理是否确实在工作。
var page = require('webpage').create();
page.open('http://checkip.org/', function (status) {
console.log("Status: " + status);
if (status === "success") {
page.render('p1pexample.png');
}
phantom.exit();
});
我调用上面的代码使用:
phantomjs pinit.js --proxy-type=http --proxy=zproxy.luminati.io:22225
--proxy-auth=lum-customer-naluaa-zone-static:xxxxxxxxxxxx
不过好像不行。快照显示的 IP 与我在没有代理的情况下获得的 IP 相同。这可能是什么原因?我使用代理的方式不正确吗?
脚本文件名必须在命令行的最后,否则代理参数将被视为脚本的参数。
phantomjs --proxy-type=http --proxy=zproxy.luminati.io:22225
--proxy-auth=lum-customer-naluaa-zone-static:xxxxxxxxxxxx pinit.js
我正在尝试通过代理使用 phantomjs
。以下代码创建页面快照,以便我可以验证代理是否确实在工作。
var page = require('webpage').create();
page.open('http://checkip.org/', function (status) {
console.log("Status: " + status);
if (status === "success") {
page.render('p1pexample.png');
}
phantom.exit();
});
我调用上面的代码使用:
phantomjs pinit.js --proxy-type=http --proxy=zproxy.luminati.io:22225
--proxy-auth=lum-customer-naluaa-zone-static:xxxxxxxxxxxx
不过好像不行。快照显示的 IP 与我在没有代理的情况下获得的 IP 相同。这可能是什么原因?我使用代理的方式不正确吗?
脚本文件名必须在命令行的最后,否则代理参数将被视为脚本的参数。
phantomjs --proxy-type=http --proxy=zproxy.luminati.io:22225
--proxy-auth=lum-customer-naluaa-zone-static:xxxxxxxxxxxx pinit.js