I tried many online methods people have suggested and still not reached a solution
i need to run a php file that contain javascript from cronjob
For now, I can not do it through PHP
If anyone has an idea I'd love to read
I tried many online methods people have suggested and still not reached a solution
i need to run a php file that contain javascript from cronjob
For now, I can not do it through PHP
If anyone has an idea I'd love to read
You will probably have to trigger it through a browser. Get a computer to open the URL via the cron tab (or some other timed device... I know you can do it through Automator/AppleScript on a Mac).
How I do it: I split the job in to tasks.
Task 1: Execute Javascript
Javascript would require a browser to run. In this respect you can try casperjs/phantomjs. You can create a a cronjob for this easily. Please check: Running a casper.js script from cron
Task 2: Deliver results to PHP
I assume that you take the results of the JS and use it in the PHP. So JSON can do the job. At the end of the first task output to a file. In this task, read it using file_get_contents.
Task 3: PHP Cron
It is obvious :)
Sure that there are better, easier and simpler solutions. I am a newbie also here, but this method all my problems for a similar work.