Abhishek
Abhishek

Reputation: 603

Call coddeigniter controller function using nodejs socket.io

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!!

Upvotes: 0

Views: 343

Answers (1)

Trushar Narodia
Trushar Narodia

Reputation: 366

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');});

Upvotes: 1

Related Questions