I have this function
function suspendido($chat_id,$foo)
{
$TOKEN = "blablalbal";
$TELEGRAM = "https://api.telegram.org:443/bot$TOKEN";
$url. = "https://zrabogados-pruebas.xyz/bot/404.png";
$query = http_build_query(array(
'chat_id'=> $chat_id,
'photo'=> $url,
'text'=> $foo,
'parse_mode'=> "HTML", // Optional: Markdown | HTML
));
$response = file_get_contents("$TELEGRAM/sendMessage?$query");
return $response;
}
I try to sending an Image without using curl, tried to use file_get_contents but nothing works. Is something missing?.
2
Answers
Apparently, there is some problem with telegram servers.
If you put some image attributes into url it works.
I know its just silly but it works that way if you send the image url without this then you will receive a 400 error.
You used
sendMessage
method, And this method isn’t acceptphoto
parameter.And
$url
shouldn’t be concatenated with another link.To send photo use
sendPhoto
method like this: