title: Get username and first name via Telegram Bot API with available matching phone number
body: <p>I have a list of phone numbers.</p>
  
  <p>I need their matching <code>username</code> and <code>first_name</code> in Telegram(if they subscribed to Telegram). </p>
  
  <p>I want to get these info(username and first_name) with Telegram BOT API. </p>
  
  <p>Is it possible? How can I do this? (with PHP)</p>
  
  <p>This is my sample code:</p>
  
  <pre><code>&lt;?php
  
  //telegram sdk and configuration
  $client = new Zelenin\Telegram\Bot\Api('someRandomToken');
  
  $update = json_decode(file_get_contents('php://input'));
  
  //your app
  try {
  
      if($update-&gt;message-&gt;text != '/next_event_datetime')
          exit;
  
      $dom = Sunra\PhpSimple\HtmlDomParser::file_get_html('http://laratalks.com/');
      $element = $dom-&gt;find('#location header.section-header h3', 0);
      $dateTime = $element-&gt;plaintext;
  
      $response = $client-&gt;sendMessage([
          'chat_id' =&gt; $update-&gt;message-&gt;chat-&gt;id,
          'text' =&gt; $dateTime
      ]);
  
  } catch (\Zelenin\Telegram\Bot\NotOkException $e) {
  
      //echo error message ot log it
      //echo $e-&gt;getMessage();
  
  }
  </code></pre>