UNPKG

eppface

Version:

epp api

38 lines (34 loc) 876 B
var https= require('https'); var nml = require('nml'); function tmnotice(xml, cb) { var json = nml.parse(xml); var v = json["tmNotice:notice"].value; cb({ noticeID : v["tmNotice:id"], notAfter : v["tmNotice:notAfter"], acceptedDate: v["tmNotice:notBefore"] }); } function tmcnis(key, cb) { var options = { hostname: 'tmcnis.org', port: 443, path: '/cnis/'+key+'.xml', method: 'GET', auth: 'cnis2218:MAY+Zodiac406' }; var req = https.request(options, function(res) { var xml = ''; res.on('data', function(d) { xml+= d; }); res.on('end', function() { (res.statusCode===200) ? tmnotice(xml, cb) : cb(); }); }); req.on('error', function(e) { cb(); }); req.end(); } module.exports = tmcnis;