Код: Выделить всё
$img_path = "https://www.example.com/path/to/file.jpg";
$method = "sendPhoto";
$arrayQuery = array(
"chat_id" => CHAT_ID,
"photo" => curl_file_create($img_path, $img_mime, $img_name),
"caption" => $caption,
"parse_mode" => "HTML",
"show_caption_above_media" => True,
);
try {
$ch = curl_init('https://api.telegram.org/bot'.BOT_TOKEN.'/'.$method);
if ($ch === false) {
throw new Exception('failed to initialize');
}
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $arrayQuery);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$res = curl_exec($ch);
if ($res === false) {
throw new Exception(curl_error($ch), curl_errno($ch));
}
} catch(Exception $e) {
trigger_error(sprintf(
'Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()),
E_USER_ERROR);
} finally {
if (is_resource($ch)) {
curl_close($ch);
}
}
Может ли кто-нибудь мне с этим помочь?
Я пытался добавить CURLOPT_SSL_VERIFYHOST false, CURLOPT_SSL_VERIFYPEER false, но безрезультатно
Подробнее здесь: https://stackoverflow.com/questions/791 ... l-error-26