Closed farshidmousavi closed 5 years ago
i have a problem. how can i get image (image id) and image caption and send it to anyone (or himself)
$data = $telegram->getData(); if(isset($data['message']['photo'])){ $Photo = $data['message']['photo']; } if(isset($data['message']['caption'])){ $caption = $data['message']['caption']; } $content = array('chat_id' => $chat_id, 'reply_markup' => $keyb,'photo' => $Photo, 'caption' => $caption); $telegram->sendPhoto($content);
Where is problem? Error returned PHP Notice: Array to string conversion in /home/mysite/public_html/telegrambot/bot.php on line 3058
PHP Notice: Array to string conversion in /home/mysite/public_html/telegrambot/bot.php on line 3058
i found my fault. $Photo = $data['message']['photo']; must be $Photo = $data['message']['photo'][0]['file_id'];
i have a problem. how can i get image (image id) and image caption and send it to anyone (or himself)
$data = $telegram->getData(); if(isset($data['message']['photo'])){ $Photo = $data['message']['photo']; } if(isset($data['message']['caption'])){ $caption = $data['message']['caption']; } $content = array('chat_id' => $chat_id, 'reply_markup' => $keyb,'photo' => $Photo, 'caption' => $caption); $telegram->sendPhoto($content);
Where is problem? Error returned
PHP Notice: Array to string conversion in /home/mysite/public_html/telegrambot/bot.php on line 3058