How to handle response from the server every couple of seconds and do it in the background on the server?

I make bot for Facebook and I need every second to check for incoming messages and respond to them, but you can't do that with the included browser)
P. S. do Not think, this is no ordinary boat toy, this phase I has already passed.
July 2nd 19 at 18:02
2 answers
July 2nd 19 at 18:04
demons/crown help
July 2nd 19 at 18:06
- create a file: bot.php content:
while (true) {
// here is your code doing their dirty work
sleep(1);
}

- go to the server via ssh
- install screen: apt-get install screen
- start a new session: screen -a
- run the script: php bot.php
- disconnect from the session: Ctrl+A+D
- if necessary, restore the session: Ctrl+D
- if you need to terminate the script, in the restored session, just press Ctrl+C

When you realize that you are not enough, Google "daemons in php"

Find more questions by tags APIPHP