Skip to content

Instantly share code, notes, and snippets.

@pswincom-examples
Last active December 31, 2015 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pswincom-examples/7941575 to your computer and use it in GitHub Desktop.
Save pswincom-examples/7941575 to your computer and use it in GitHub Desktop.
Simple example for node.js
var https = require('https');
var post_data = "<?xml version=\"1.0\"?>\
<SESSION>\
<CLIENT>myusername</CLIENT>\
<PW>mypassword</PW>\
<MSGLST>\
<MSG>\
<TEXT>Test message</TEXT>\
<RCV>4799999999</RCV>\
</MSG>\
</MSGLST>\
</SESSION>";
var post_req = https.request(
{
hostname: "sms.pswin.com",
path: "/XMLHttpWrapper/Process.aspx",
method: "POST",
headers: {
'Content-Type': 'application/xml',
'Content-Length': post_data.length
}
},
function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
}
);
post_req.write(post_data);
post_req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment