Someone Could tell me how start node function from PHP. For example I want to load some data from node http request and load it to PHP website. Please put any tutorials or part of code.
You could use php's exec
- http://php.net/manual/en/function.exec.php - just so long as you are not using any user input in your command. I don't know of a tutorial for this.
Here is a SO on the different ways to make calls to your system: PHP - exec() vs system() vs passthru()
Your node.js code should run a simple http server listening on the loopback interface, so your php code can request the data using a http request.
Another option is to run the node server on a public url (on a different port or using a reverse proxy) and let it return data using JSONP.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.