A
A
arsenaljek2021-06-28 07:22:34
PHP
arsenaljek, 2021-06-28 07:22:34

How to monitor the admin panel of someone else's site, where orders appear periodically?

Tell me how to write a script that will monitor the receipt of new orders and send them to the cart bot? Actually I did all this, but it does not work correctly.
I wrote a script that uses the API to get a list of orders that have the "Processing" status and send it to telegram. The script runs on a cron every minute and every minute I receive empty messages in my mail, because at the time the script was triggered there were no new orders. Or vice versa, there is an order, and since it is being processed and the script is running every minute, then these messages will be sent every minute until the order status is changed.
What is the right way to write things that will track changes on another site?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2021-06-28
@sergiks

it is necessary to save the state of the last monitoring, and next time to compare with the saved one. Show changes.

S
Sergey, 2021-06-28
@sslion

an obvious solution to store the orders you have already received, and accordingly it will be possible not to duplicate them in messages. how you will store decide for yourself, you can even shove it into SQLite)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question