The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Executing php script every 30 seconds?
I currently have the following code in in a custom page which works fine executing a php script.
Code:
exec('php -q /path/to/file/getImage.php'); What I'm trying to do is get this to execute every 30 seconds while the page is loaded. I've tried something like this, but it wouldn't work. Code:
<script type="text/javascript"> jQuery(document).ready(function() { setInterval(function() { jQuery.get('/path/to/file/getImage.php'); }, 30000); }); </script> |
#2
|
|||
|
|||
Add it to a cron
0,30 * * * * /path/to/php /path/to/file/getImage.php |
#3
|
|||
|
|||
It depends on how your server is configured, but the path to the file that you'd use in the exec command usually isn't the same as what you'd use while requesting it via http (which is what a jquery get() does).
I don't understand why in the first code you posted you're using exec(), but in the javascript you're calling getImage.php directly (I'm not saying it's wrong, I'm just curious). ETA:...or use cron like snakes says above. |
#4
|
|||
|
|||
looks like i beat by sec's lol
|
#5
|
||||
|
||||
Edit:
......original code ended up working, the issue was the php I was trying to call was outside the public root and it wouldn't execute from the vB template from there (but it would from the main .php). Moved the php into a public directory and it worked. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|