From node.js I would like to get JSON data from a PHP file. I thought about using the request package, but I am not sure about what to write in the PHP file in order to send the JSON back to node:
Node:
var request = require('request');
request
.get('http://IP/File.php')
.on('response', function(response) {
data = JSON.parse(data from the php file);
});
PHP:
$data = array('message' => 'HeLLO');
$json = json_encode($data);
when executing this, send $json to node