Z
Z
ZaurK2017-01-31 18:32:59
PHP
ZaurK, 2017-01-31 18:32:59

How to run casperjs via php script?

Hello! I study casperjs according to the documentation and through the terminal I can successfully run the example
script here is the script

var casper = require("casper").create();

casper.echo("Casper CLI passed args:");
require("utils").dump(casper.cli.args);

casper.echo("Casper CLI passed options:");
require("utils").dump(casper.cli.options);

casper.exit();

here is the command in terminal to run the script '$ casperjs test.js arg1 arg2 arg3 --foo=bar --plop anotherarg'.
Everything works well, but the problem is that the task arose to run the script through php, and I can’t implement it in any way. Please advise how to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Ananiev, 2017-04-26
@yoj_nc

print shell_exec('casperjs test.js arg1 arg2 arg3 --foo=bar --plop anotherarg');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question