Hi,

I have PHP script which is calculating some Google Maps API functions in Javascript and then sending output back to PHP.

My biggest problem is, that i need it to run at intervals, but AFAIK cron can't handle javascript

I've tried a little workaround - setting cron which sends the url to online web thumbnail generator - and it works. Until this online service denied loading scripts at their side.

It must be some way to achieve this. Maybe running some instance of browser in PHP?

Recommended Answers

All 6 Replies

Member Avatar for GreenDay2001

There is no direct/good way. You have to run you code in a browser somehow. Maybe if your server allows, save the output in file and run "firefox file.htm".

Also, in Windows I think you can get your work done using PHP and COM components. But again a lot is dependent upon your host. If you have your own server or have good control, maybe you can get what you want.

Or maybe there's some online service allowing to run a webpage like one that i was using (thumbalizr.com). Does anyone know?

You can use cron to call a php page.
IN your crontab file, the command part would be something like this:

/usr/bin/php /users/me/www/myfile.php

You can use cron to call a php page.
IN your crontab file, the command part would be something like this:

/usr/bin/php /users/me/www/myfile.php

Cron can not run client-side Javascript...

Perhaps a site uptime checking service.

Or if you have a pc running 24/7, open the page in Opera and set it to refresh at your interval.

commented: New option for me - uptime checking +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.