0

There is a local file:

$file = "some russian text here.txt";

Sent by standard Curl as a document:

$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: multipart/form-data']);
curl_setopt($ch, CURLOPT_URL, 'https://api.telegram.org/botToken/sendDocument');
$postFields = array(
    'chat_id' => '11111',
    'document' => new curlfile(realpath($file)),
);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);

$output = curl_exec($ch);

// convert response
$output = json_decode($output);

// handle error; error output
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {

    var_dump($output);
}
curl_close($ch);

In response:

NULL

If the name of the file in Latin all sends without problems. The problem as I understand it in Russian characters. Really it is impossible to send a file with this name (with russian symbols)?

hopea114y
  • 11
  • 5

0 Answers0