Answer the question
In order to leave comments, you need to log in
ajax alternative in php?
How to access the ajax handler through php and all this on the crown?
For example, you need to find out if the user is logged in, if yes, then the example.ru/api/check.php handler returns true, if not, false. In js, everything is simple. And I need to get the result (true / false) and then work with it in php. And so that all this is done on cron'e
Answer the question
In order to leave comments, you need to log in
If both the cron script and the /api/check.php route are part of the same web application, then it makes sense to avoid the HTTP request if possible.
It is better to move the registration check logic into a separate method, conditionally User::isRegistered(), and use it both in the cron script and in the api.
As an option, you hang up the execution of the script on cron, and in the script, after checking, you execute what you need or send a message to the queue and already process the message from the queue. Or if you need to immediately update something with clients, use web sockets.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question