-
-
Save augustohp/6942270 to your computer and use it in GitHub Desktop.
Question on StackOverflow: http://stackoverflow.com/questions/19327297/node-http-get-how-do-i-get-at-the-xml-returned-so-i-can-do-stuff-with-it/19327528#19327528
This file contains hidden or 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'); | |
var xmld = require('xml2js'); | |
var express = require('express'); | |
var app = express(); | |
// app.use(express.static(__dirname + '/public')); | |
app.get("/", function (req, res) { | |
var options = { | |
hostname: "search.mysite.com", | |
path: '/search?site=hub&client=hub_frontend&output=xml_no_dtd&q=cats' | |
}; | |
var gsaReq = http.get(options, function (response) { | |
var completeResponse = ''; | |
response.on('data', function (chunk) { | |
completeResponse += chunk; | |
}); | |
response.on('end', function() { | |
console.log(completeResponse); | |
}) | |
}).on('error', function (e) { | |
console.log('problem with request: ' + e.message); | |
}); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment