Search code examples
phpdatabaseapitwitch

Run a code without any users online - Twitch API


Okay this might sound stupid? But is it possible to make my website / server run a code without the need of a user to trigger the code?

I need this for a website linked to a twitch streamer. Unfortunately (by my knowledge) the twitch api only allows you to retrieve information about a channel when it's online.

This makes it impossible for me to display a follower / sub counter unless the streamer is online.

I know i could store the last registerede amount in my database, but the site could potentialy be without any viewers while the streamer is online for quite a while and therefore not be really precise.

It is not a requirement that no users are online, i want the code to run also when nobody is online :)

so to sum it up: Is it possible to run a code without users online?

Else if anybody knows an alternative than the regular twitch api Kraken that could fix this it would be great :)

Thanks in advance.


Solution

  • As a proggrammer you will need to run many scripts automaticly, and the best way to do that is by making a crontab. If you are using a linux you can check this and if you are a windows user you can check this