<?php
function callAPI($method, $token, $parameters) {
$parameters_json = json_encode($parameters);
$result = file_get_contents('
https://api.telegram.org/bot' . $token . '/' . $method, false, stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => array(
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($parameters_json),
),
'content' => $parameters_json,
),
)));
return $result;
}