Centos服务器上的CasperJs如何使用php将变量传递给casper js

Okay so i have a casperjs script which does a specific task for me then echoes a result back to me.

i normally use the command

Casperjs script.js "variable1" "variable2"

after a few moments it will echo a results saying either

True

or

False

how can i use php on my server instead of using the command line i would like the php script to execute the command above and then echo the result back to me on my php page

You can use PHP's shell_exec which uses php to call your command, like so:

.php

$casperjs = "casperjs";
$script = "script.js";
$arg0 = $variable1; 
$arg1 = $variable2;
$command = "$casperjs $script $arg0 $arg1";
$result = shell_exec($command);
echo $result;   

script.js

var casper = require('casper').create();
var arg0 = casper.cli.get(0);
var arg1 = casper.cli.get(1);
casper.start('http://example.com/', function() {
  if (this.getTitle() == 'blahblah') {
    this.echo('True');
  } else {
    this.echo('False');
  }
});     
casper.run();