0

I am new with node Js socket programming, I want to call php function from nodejs socket.

I don't know is it possible but let me know if it is possible.

Thanks in advance!!

Nishant Nair
  • 1,999
  • 1
  • 13
  • 18
Abhishek
  • 583
  • 5
  • 16

1 Answers1

1

var req = httpcall.request('http://your_url/controller/function/data, function (res) {
        res.setEncoding('utf8');
         res.on('data', function (chunk) {
         // console.log('BODY: ' + chunk);                 });
         
       });
       
       req.on('error', function(err) {
        console.error('error: ' , err.stack.split("\n"));
       });

try with http

var httpcall = require('http');
httpcall.createServer(function (req, res) { });
var req = httpcall.request('http://yoursite/controller/function/, function (res) {
                            res.setEncoding('utf8');});
Trushar Narodia
  • 366
  • 4
  • 19