Answer the question
In order to leave comments, you need to log in
When a parameter of Russian characters is passed in a GET request, the script does not work. What is the reason?
From 1C there is a GET request. One of the parameters is the file name. And it is sometimes called Russian symbols.
https://мойсервер/telegrambot/file.php?apibot=24953021_______Pnjwywdkg&chatid=-1003333102111&document=Продажи_месяц_май.xls
header('Content-Type: text/html; charset= utf-8');
$botToken = $_GET['apibot'];
$website="https://api.telegram.org/bot".$botToken;
$chatId = $_GET['chatid']; //Receiver Chat Id
$caption = $_GET['caption'];
$file_send = "./file_temp/".$_GET['document'];
$file_s = iconv("windows-1251","UTF-8",$file_send);
$file_name_with_full_path = realpath($file_s);
$params=array(
'chat_id'=>$chatId,
'document' => '@'.$file_name_with_full_path,
'caption' => $caption,
);
$proxy_port = "1080";
$proxy_ip = "___.me";
$loginpassw = '126____1ba';
$ch = curl_init($website . '/senddocument');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $loginpassw);
curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
Answer the question
In order to leave comments, you need to log in
1) I think this line is redundant
2) The line above is better to wrap
$file_send = './file_temp/'.basename($_GET['document']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question