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

1 Answer 1

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');});
Sign up to request clarification or add additional context in comments.

3 Comments

thanks tushar, I tried this but I am not able to get response from php function, could you please tell me how to send response and get in node js. thanks once again..
if you are using core PHP then pass param in url and get in php file witl $_REQUEST

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.