title: Send message to all telegram bot members
body: <p>I wrote a telegram bot with php . I want to send a text to all Members, I saved all members chat_id.
  I tried to send message with this function :</p>
  
  <pre><code>function sendMessage($chatId, $message) {
  
      $url = WEBSITE . "/sendMessage?chat_id=" . $chatId . "&amp;text=" . urlencode($message);
      file_get_contents($url);
  }
  </code></pre>
  
  <p>and use this function for get user chatid and send message:</p>
  
  <pre><code>public function sendall($message) {
          $sql = $this-&gt;con-&gt;prepare('SELECT * FROM `users`');
          $sql-&gt;execute();
          $res = $sql-&gt;fetchAll();
          foreach ($res as $row) {
              sendMessage($row['chatid'], $message);
          }
          exit();
      }
  </code></pre>
  
  <p>But this is not working correctly and the message is sent to members several times and it does not stop until I clear my database.</p>