This is a simple php code
<?php
ob_start(passthru('/usr/bin/env node getResult.js '));
$data = ob_get_contents();
ob_end_clean();
// console shows Data as String but $data is still empty
echo "Data : " . $data;
?>
And the node.js script just has a variable result with an object in it.
console.log("skript startet");
var get = function(){
/*do stuff to get variable*/
result = "test;
console.log(result);
return result;
});
});
};
get();
Problem: I need the variable in the getResult.js script but I cant' catch it in php. Any Ideas ?