How to use Node.js to run a PHP page?

2

In my case, the following is occurring: the microcontroller sends data using GET to the server, it saves to the MySQL database and tests if the alert needs to be triggered. This alert is done with a PHP page that uses jQuery + Ajax to send to another server, this already works, however, you need a browser to run the jQuery application because it is client side and not possible with the microcontroller. I searched and saw that it would be the case to use Node.js to process this on the server side. Here comes the question: how would I do to Node.js run this PHP page?

    
asked by anonymous 05.04.2015 / 00:33

1 answer

0

For the node to run the page I see no problem, you simply configure it, run the script that calls the php and order, but I think the most elegant solution is to make the php itself keep calling itself (everything on the side of the server)

I have a case like this here, I get information via SOA like php that writes to my mysql, before I had to stay with an open browser and the page that was collecting data there, the script had a recursion to call the page again every 30 sec.

Well now I did in the shell-script a "process" that makes this service to me

#php arquivo.php &
  

this & important because it will ensure that the process is running smoothly.   even if you close a session

If you want to know more about the nodeJS link you have the steps of how to configure it, it's javascript, from there to the front, just call your php page recursively gives the same result however, it's a setup / setup as far as I can see.

(use nodeJS in other cases as socket, tell system browsers that an event has run and browsers start to execute a certain javascript instruction, chat is another example etc.)

    
10.04.2015 / 22:27