title: Sending message using Telegram api
body: <p>I have some <code>PHP</code> code to sending message to <code>Telegram_bot</code>:</p>
  
  <pre><code>$telegrambot = "xxxxxxx"; 
  $website="https://api.telegram.org/bot".$telegrambot; 
  $chatId=yyyyyyy; 
  $params=array('chat_id'=&gt;$chatId,'text'=&gt;$msg,);    
  
  $ch = curl_init($website . '/sendMessage'); 
  curl_setopt($ch, CURLOPT_HEADER, false); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt($ch, CURLOPT_POST, 1); 
  curl_setopt($ch, CURLOPT_POSTFIELDS, ($params)); 
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
  $result = curl_exec($ch); 
  curl_close($ch);
  </code></pre>
  
  <p>I used <code>curl</code> because using <code>file_get_contents()</code> or <code>fopen()</code> causes <code>connection refused</code> error. But still it doesn't work. How should I fix it?</p>