Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php cron job execute javascript as well

I have a cron job running a php script, but theres some html and javascript that I need to execute for the actual script to work.

Converting the javascript to php isnt an option.

Basically I need it to act as though a person is viewing the page every time the cronjob runs.

EDIT: the script uses javascript from a different site to encrypt some passwords so it is able to log into my account on the site, and the javascript is thousands of lines. The way the script flows is: Send data to website>get the data it sends back>use sites javascript to alter data>set html form value to value of data returned by javascript function>submit html form to get info back to php>send data to log me in. I know the code is very shoddy but its the only way i could think to do it without having to rewrite all the javascript they use to encrypt the password to php

like image 921
Max Avatar asked Mar 05 '26 07:03

Max


2 Answers

Yau can try Node.JS to run JavaScript code on the server.

like image 140
Olegas Avatar answered Mar 07 '26 21:03

Olegas


install your favorite web browser, and then have the cron job run the browser with the url as an argument.

something like

/usr/bin/firefox www.example.com/foo.html

you'll probably want to wait a minute or so and then kill the processes, or determine a better way to find when it finishes.

like image 29
goat Avatar answered Mar 07 '26 21:03

goat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!