Created
September 13, 2010 06:20
-
-
Save bxjx/576884 to your computer and use it in GitHub Desktop.
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
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