Skip to content

Instantly share code, notes, and snippets.

@bxjx
Created September 13, 2010 06:20
Show Gist options
  • Save bxjx/576884 to your computer and use it in GitHub Desktop.
Save bxjx/576884 to your computer and use it in GitHub Desktop.
var http = require('http');
function getXml(cb){
var host = 'node.geht-ab.net';
var url = '/original.php'
var server = http.createClient(80, host);
var request = server.request('GET', url, { Host: host });
request.end();
request.on('response', function (response) {
response.setEncoding("binary");
var body = "";
response.on('data', function (data) { body += data; });
response.on('end', function () {
cb(body);
});
});
}
http.createServer(function (req, res) {
getXml(function(data){
res.writeHead(200, {'Content-Type': "text/xml;charset=ISO-8859-1"});
res.end(data, 'binary');
});
}).listen(3001);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment