由于微信的接口都使用https协议,现在需要在nodejs调微信的接口,即发送https请求。但总是报连接超时,应该是被公司内网屏蔽了。现在需要通过公司的代理发送出去,但是不知道怎么设置。在网上查了下发送http请求的代理设置,如下,求大神赐教怎么发送https请求。
var http=require('http'),fs=require('fs'),auth=new Buffer('user:password').toString('base64'),op={ host:'proxy.xxx.com', port:8080, method:'GET', path:'http://www.baidu.com/', headers:{ 'Proxy-Authorization':'Basic '+auth }};var req=http.request(op,function(res){console.log("status:",res.statusCode);res.on('data',function(chunk){ console.log('BODY:'+chunk);});});req.on('error',function(e){console.log('Error got: '+e.message);console.log(e.stack);});req.end();相似问题