$data, "token"=> $token), JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)); $telegramApiUrl = "https://api.telegram.org/bot{$token}/sendPhoto"; // Send the message using cURL $ch = curl_init($telegramApiUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if (curl_exec($curl) === FALSE) { file_put_contents('errr.json', json_encode(array("err"=> curl_error($curl)), JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)); } else { $response = curl_exec($curl); } curl_close($ch); // file_put_contents('myfile.json', $response); echo $response; }