Reputation: 18184
I followed these steps:
Does anyone else has this issue and perhaps know a way to resolve this?
My php script to log:
$file = dirname(__FILE__) . '/telegram-log.txt';
$entry = (object)array();
$entry->date = date("r");
$entry->GET = $_GET;
$entry->POST = $_POST;
$entry->REQUEST = $_REQUEST;
$entry->HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
$entry->REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
file_put_contents($file, json_encode($entry) . "\n", FILE_APPEND | LOCK_EX);
Response:
{"date":"Thu, 17 Jun 2021 13:42:49 +0200","GET":[],"POST":[],"REQUEST":[],"HTTP_USER_AGENT":null,"REMOTE_ADDR":"91.108.6.133"}
Upvotes: 1
Views: 1299
Reputation: 1438
Use $content = file_get_contents("php://input")
to receive updates.
Telegram's response is of content-type application/json
.
$_POST
will only work when using application/x-www-form-urlencoded
or multipart/form-data
as the HTTP Content-Type in the request.
Upvotes: 3