0

I have a PHP function that checks for the occurence of a string. What I want is to have it checked continously at a certain interval(eg: 5 seconds). From what I've gathered, PHP would be lesst than optimal for this 'refresh' function so looking for a way to do it with JS.

Thanks in advance and sorry for the silly question!

Cyrus
  • 7
  • 6

1 Answers1

0

I don't think PHP would be less than optimal, but either way, I don't know of an "Easy" way. Cron jobs would typically be perfect for what you need, but they do not run sub-minute (although I have seen interesting workarounds).

Node has a lot of packages for "cron" like functionality, but these take the same parameters, so no sub-minute.

You could utilize a setInterval() callback to accomplish this easily, but it would require you to a) keep a web client open 24/7 and b) monitor the web client to ensure it never freezes, fails, shuts down, etc.

Community
  • 1
  • 1
Chris
  • 4,762
  • 3
  • 44
  • 79