Commit 7e26aeff4775207bc5bde33f966517ee35ca41b8
1 parent
88b4e0d50f
Exists in
master
coba plain http req
Showing 1 changed file with 26 additions and 1 deletions Side-by-side Diff
partner-datacell.js
... | ... | @@ -65,6 +65,7 @@ function topupRequest(task, retry) { |
65 | 65 | var payload_xml = createPayload(task); |
66 | 66 | console.log(payload_xml); |
67 | 67 | |
68 | + /* | |
68 | 69 | request({uri: config.h2h_out.partner, method: 'POST'}, function(error, response, body) { |
69 | 70 | if (error) { |
70 | 71 | var error_mesasge = 'Error requesting to partner: ' + error; |
... | ... | @@ -84,8 +85,32 @@ function topupRequest(task, retry) { |
84 | 85 | console.log(body); |
85 | 86 | callbackReport(task['requestId'], '68', 'cek'); |
86 | 87 | |
87 | - }).end(payload_xml);; | |
88 | + }).end(payload_xml); | |
89 | + */ | |
88 | 90 | |
91 | + var postRequest = { | |
92 | + host: "202.152.62.2", | |
93 | + path: "/RELOAD97.php", | |
94 | + port: 7713, | |
95 | + method: "POST" | |
96 | + }; | |
97 | + | |
98 | + var buffer = ""; | |
99 | + var req = http.request( postRequest, function( res ) { | |
100 | + | |
101 | + console.log( res.statusCode ); | |
102 | + var buffer = ""; | |
103 | + res.on( "data", function( data ) { buffer = buffer + data; } ); | |
104 | + res.on( "end", function( data ) { console.log( buffer ); } ); | |
105 | + | |
106 | + }); | |
107 | + | |
108 | + req.on('error', function(e) { | |
109 | + console.log('problem with request: ' + e.message); | |
110 | + }); | |
111 | + | |
112 | + req.write( payload_xml ); | |
113 | + req.end(); | |
89 | 114 | } |
90 | 115 | |
91 | 116 | function createServer() { |