How to run casperJS script from php API

前端 未结 2 1026
灰色年华
灰色年华 2021-01-15 18:58

I have a casperJS script which returns JSON when run via commandline. I want to make an API preferably in PHP which runs the script as in commandline (casperJS sample.js) an

2条回答
  •  一个人的身影
    2021-01-15 19:31

    I think you can use php exec() function as shown below to do this

    echo exec("/home/user/casperjs/bin/casperjs /full/path/to/your_script.js");
    

提交回复
热议问题