kr_ilya2019-12-31 14:34:00
kr_ilya, 2019-12-31 14:34:00

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

4 answer(s)
Ivan Shumov, 2019-12-31


eugenezadorin, 2019-01-01

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.

Tekram, 2019-01-01

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.

arseniylebedev, 2019-01-01


Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question