Hello
I have a PHP script that retrieves data from another website which then insert into my database. The problem is that the script is updated using HTML (<meta http-equiv="refresh" content="1">) so when I shut down the browser so the script stops working. So I need an ajax script that runs in the background every second even when the browser is closed. I turn to you because I can't AJAX at all.
Well.. You can't do it with AJAX, you must use cron for it.
cron scripts can't run more often than each minute.
cron is similar to task scheduler in windows, but in the *nixWiki world instead. if you are on a web hotel, they need to allow you to add cron scripts. many do, most don't.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
Well.. your server has to have "Cron jobs" enabled.. I mean it has to be enabled in your Control panel..
But what Control panel are you using ?
Quoting a friend:
According to him, should I use ajax as described above.You have a script that kicks off at startup. Then you have the while-loop with a timer routine in.
While loop is made that it is always true, type (1 == 1), and then in the loop so you have a delay, either based on a timer or it makes a bit pointless crap in the background that takes time. It is up to you what you want to do.
Then make it a poll on the site, and parses the poll and store relevant data in a database. Do not forget to lock the database before writing to prevent multiple writes to the same database at the same time.
You put it in startup simply.
well, sure, but then you really need a computer with a web browser open to always run that script?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks