How can I "import" a PHP array into a seperate NodeJS file?
Example:
example.php
<?php
return array(
'title' => 'Example Value',
'description' => 'Example Value'
);
My attempt was to read it through executing the file but then I only get an empty response
const runner = require('child_process');
const scriptPath = 'pathtofile/filename.php';
runner.exec('php ' + scriptPath, (err, phpResponse, stderr) => {
console.log(phpResponse);
})
Note that I cannot modify the PHP files.