title: Telegram Bot - PHP Webhook POST to file
body: <p>I've already read the few questions about bot API, but can't find a solution.</p>
  
  <p>My bot works fine without setting a webhook and processing /getUpdates. But I can't get it working setting "<a href="https://www.domain.com/page.php" rel="nofollow">https://www.domain.com/page.php</a>" as webhook.</p>
  
  <p>I've got a shared hosting behind Cloudflare's Flexible SSL cert and browsers doesn't warn about it, so I assume it's working fine.</p>
  
  <p>I'm trying to get Telegram's POST to a file to have a clue if webhook need diferent parsing, but it is empty and can't see ssl_acces.log, so I can't even watch if Telegram reach the page...</p>
  
  <p>Here is the snippet:</p>
  
  <pre><code>$message = json_decode(file_get_contents('php://input'), true);
  file_put_contents('telegram.txt', var_dump($message));
  </code></pre>
  
  <p>What am I doing wrong? Thanks.</p>
  
  <p>[SOLUTION]</p>
  
  <p>The way to log is:</p>
  
  <pre><code>$debug = file_get_contents('php://input');
  $fp = fopen('debug.txt', 'w');
  fwrite($fp, $debug);
  fclose($fp);
  </code></pre>
  
  <p>And the solution is that the webhook must be set without wwww:
  <code>/setwebhook?url=https://domain.com/page.php</code></p>