1

I have a casperJS script which returns a JSON when run on commandline. I want to have an arrangement such that 1) I create a webpage 2) On clicking a button on the webpage the casperJS scripts gets executed at the server side and post/return the result back to the webpage.

How can i do the same.

EDIT: I am invoking an AJAX process written in php on clicking the buttom. The php script contains echo exec('casperjs sample.js');
It returned nothing but on checking the webserver error log I got the error
'casperjs' is not recognized as an internal or external command, operable program or batch file.

PS: It running absolutely fine via commandline.

EDIT2
I changed the php script to:
echo exec('C:\casperjs\batchbin\casperjs .\sample.js');
The error got modified to :
'phantonjs' is not recognized as an internal or external command, operable program or batch file.

user2129794
  • 2,388
  • 8
  • 33
  • 51
  • Possible duplicate of [CasperJS passing data back to PHP](http://stackoverflow.com/questions/15852987/casperjs-passing-data-back-to-php) – danielepolencic Aug 20 '13 at 09:42

1 Answers1

1

I have found solution from my post on google group

https://groups.google.com/forum/#!topic/casperjs/7Lps6TiX-78

It worked by moving CasperJS & PhantomJS executable file in the directory server (/html)

user2129794
  • 2,388
  • 8
  • 33
  • 51