How to run casperJS script from php API

前端 未结 2 995
灰色年华
灰色年华 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:24

    You can use php-casperjs library which is a simple wrapper for casperjs.

    0 讨论(0)
  • 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");
    
    0 讨论(0)
提交回复
热议问题