Answer the question
In order to leave comments, you need to log in
Is the process of creating a bot in PHP correct?
The user of one site asked to write a bot for him, which will log in on his behalf, receive messages, and send them.
There is a problem: this site does not have an API, so everything will have to be done through CURL.
I write the login code after I log in:
I need to immediately write the code so that it goes to PM and parses the LAST MESSAGE, right? If it is not from ME, and it is not equal to the message that was received by the previous one, then ignore it, otherwise write the message sending code with all POST fields, right?
I will upload the script with the bot to the page on the hosting, and it should always be enabled for the person, and this script should be updated via AJAX every (say, 10 seconds).
I want to clarify whether I described everything correctly, please correct me in something. And also, if someone has the code on the github for creating a bot, please share. In Google, I only met "we write a telegram chat bot", etc., but we work with telegram through their api, but here we have to
Answer the question
In order to leave comments, you need to log in
you need to immediately write the code so that it goes to PM and parses the LAST MESSAGE, right?If several messages come in between checks, do you only parse one?
and it should always be enabled on a human, and this script should be updated via AJAX every (let's say 10 seconds).why not cron, for example?
To begin with, it is better to understand how the work with messages on the site itself is implemented. What technology is used - polling, long-polling, websocket, server-sent events? Based on this, it is already necessary to analyze traffic and build your own similar application.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question