title: Send a message from a telegram bot at a specific time php
body: <p>i am trying to develop a simple telegram bot in php. I want my bot to send a message at the same time every day. I tried to insert in the if that checks if I write &quot;/ start&quot; this loop:</p>
  <pre><code>$tosend = time(); //I find the current time
          while(1)
          {
              sleep(1); 
              if(time() &gt; $tosend)  //If the current time exceeds the recorded one, I send the message
              {
                  sendMessage($id, &quot;Ciao&quot;);
                  $tosend += 3600;
              }
          }
  </code></pre>
  <p>It works partially. In addition to the &quot;hello&quot; message he also sends other messages that he shouldn't send, the frequency of sending the message is not one hour (as in the case above) and the rest of the bot is very slow (I think because of the infinite loop). Is there a better method or can I improve this? Thank you all</p>