Last active
August 29, 2015 14:16
-
-
Save coolicer/880c617081503e69de70 to your computer and use it in GitHub Desktop.
proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(req.url == '/data/get') { | |
var post_data = querystring.stringify({ | |
proc: 'getConfig' | |
}); | |
var options = { | |
host: '192.168.1.246', | |
port:80, | |
path: '/data/get', | |
method: 'POST', | |
headers: { | |
'Content-Length': post_data.length | |
} | |
}; | |
var body = '' | |
var client_req = http.request(options, function(res) { | |
console.log("Got response: " + res.statusCode); | |
res | |
.on('data',function(d){ | |
body += d; | |
}) | |
.on('end', function(){ | |
console.log(res.headers) | |
console.log(body) | |
}); | |
}).on('error', function(e) { | |
console.log("Got error: " + e.message); | |
}) | |
client_req.write(post_data) | |
client_req.end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment