I have a PHP script running and supposedly I'd like to trigger Node.js firing an event to the client side when certain PHP logic has been fulfilled, how should I do it? The Node.js part is still yet to be set up, but will probably be on a different server other than the PHP/Apache one, and being put behind an Nginx which functions as a reverse proxy.
Try:
<?php
$ch = curl_init();
$data = array('name' => 'Foo', 'file' => '@/home/user/test.png');
curl_setopt($ch, CURLOPT_URL, 'http://localhost:8000/'); /* Node app*/
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
?>
Review:
You can connect with your php server to a node.js server, yes.
See the NodeLog Class on this page as an example,
http://gonzalo123.com/2011/05/09/real-time-monitoring-php-applications-with-websockets-and-node-js/
It's just a socket at the end of the day.