Created
May 25, 2015 06:55
-
-
Save Junch/371bc88e26f068eb2d21 to your computer and use it in GitHub Desktop.
Post a message from Nodejs
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
| // https://nodejs.org/api/http.html#http_http | |
| var http=require('http'); | |
| var querystring=require('querystring'); | |
| var postData = querystring.stringify({ | |
| connection_string: "User Id=xxxx;Password=xxxxxx;Data Source=ussclpecergp-scan.autodesk.com/CERPRD.autodesk.com" | |
| }); | |
| var options = { | |
| hostname: 'cerreport.autodesk.com', | |
| port: 8080, | |
| path: '/OracleDbAccount', | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/x-www-form-urlencoded', | |
| 'Content-Length': postData.length | |
| } | |
| }; | |
| var req = http.request(options, function(res) { | |
| console.log('STATUS: ' + res.statusCode); | |
| console.log('HEADERS: ' + JSON.stringify(res.headers)); | |
| res.setEncoding('utf8'); | |
| res.on('data', function (chunk) { | |
| console.log('BODY: ' + chunk); | |
| }); | |
| }); | |
| req.on('error', function(e) { | |
| console.log('problem with request: ' + e.message); | |
| }); | |
| // write data to request body | |
| req.write(postData); | |
| req.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment