node.js - 请问phantom-proxy如何设置代理ip
伊谢尔伦
伊谢尔伦 2017-04-17 11:20:01
0
2
711

现在有IP如下:
192.168.2.45:8088

使用phantomjs 在cli下设置代理IP,可以如下
phantomjs --proxy=192.168.2.45:8088 simple.js

现在,我希望在node中直接使用代理,我知道这个plugin
https://github.com/sheebz/phantom-proxy

请问使用phantom-proxy,node中直接设置代理IP,而不是在cli中设置?
或者是如何使用phantom,在node中直接设置代理IP,而不是在cli中?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
PHPzhong

Use phantom (module address) This module can meet your requirements.

var phantom = require('phantom');

phantom.create('--proxy=192.168.2.45:8088', function (ph) {
  ph.createPage(function (page) {
    page.open('http://....', function (status) {
      //...
      //...

      ph.exit();
    });
  });
});

Supplement, use phantom-proxy

I just took a look at the document of phantom-proxy. The author has reserved an interface for setting the proxy, but it has not been implemented yet. Here is a piece of his code:

//may integrate in future
var defaultoptions = {
  ...
  'proxy': '0',
  ...
};

For the complete code, see https://github.com/sheebz/phantom-proxy/blob/master/lib/proxy.js#L42

大家讲道理

http://www.haoservice.com/docs/39 This is the interface of ip proxy

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template