1. 安装

npm install request --save-dev
npm install socks5-http-client

2. 代码

var request = require('request')
var Agent = require('socks5-http-client/lib/Agent')
var request_option = {
    url: 'http://www.google.com',
    agentClass: Agent,
    agentOptions: {
        socksHost: '127.0.0.1',
        socksPort: 1080
    }
}
node.request(request_option, (err, res, body) => {
    // balabala
})
发表评论
molin
request(request_option, (err, res, body) => { })
molin
下面的node是从哪来的?