Created
July 30, 2010 21:37
-
-
Save jfhbrook/501359 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
//Does the equivalent of: | |
// curl -d 'url=http://www.google.com' http://www.ln-s.net/home/api.jsp | |
var http = require('http'); | |
var querystring = require('querystring'); | |
var client = http.createClient(80, 'www.ln-s.net'); | |
var query = querystring.stringify({url: 'http://www.google.com'}); | |
var request = client.request('POST', '/home/api.jsp?'+query, {host: 'ln-s.net'}); | |
//request.write(query); | |
request.on('response', function (response) { | |
//console.log('STATUS: ' + response.statusCode); | |
//console.log('HEADERS: ' + JSON.stringify(response.headers)); | |
response.on('data', function (chunk) { | |
console.log('BODY: '+ chunk); | |
}); | |
}); | |
request.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment