天天看点

nodejs http代理请求

一些免费到代理地址

http://www.xicidaili.com/nn

https://proxy.l337.tech/txt

http://www.66ip.cn/nm.html

以下代码可以测试你是否正常代理,同时也能验证你的代理是否有效。

request({
        method: 'GET',
        url: 'http://ip.chinaz.com/getip.aspx',
        timeout: 8000,
        encoding: null,
        proxy: 'http://91.205.239.120:8080'
    }, function (err, _res, body) {
        if (err) throw new Error(err)
        body = body.toString();
        console.log(body);
    })      

转载于:https://www.cnblogs.com/CyLee/p/9209301.html