1

I wrote simple http request but I don't know how to send data to index.html. Could you help me ?

 http.get({
    hostname: 'simsms.org',
    path: `/priemnik.php?metod=get_balance&service=opt4&id=&apikey=***`
    }, (res) => {
    var body = '';
    res.on('data', function (d) {
        body += d;
    });
    res.on('end', function () {
        try {
            data = JSON.parse(body);
           console.log(data);

        } catch (err) {
            console.log(err);
        }
    });
});
  • Possible duplicate of [How to make an HTTP POST request in node.js?](http://stackoverflow.com/questions/6158933/how-to-make-an-http-post-request-in-node-js) – mattdevio Mar 16 '17 at 19:50
  • This is a `GET` request, and normally you put data in URL parameters for `GET`. – shaochuancs Mar 17 '17 at 04:16
  • In question, you need to send data to `index.html`. But in the code, the destination is `priemnik.php`. Is this mismatch a mistake or intended to? – shaochuancs Mar 17 '17 at 04:19

0 Answers0