I’m trying to get data from CasperJS like this:
Contents of file.php
:
$casperjs = "casperjs";
$script = 'add_site.js';
$arg0 = $_POST['new_site'];
$command = "$casperjs $script $arg0";
$result = shell_exec($command);
echo $result;
Contents of casperjs.js
:
casper.then(function() {
// some code
utils.dump(JSON.stringify(site));
});
casper.run(function() {
this.exit();
});
I have nothing on output.