简体   繁体   English

使用php bot在电报上发送带有照片的长消息

[英]send long message with photo on telegram with php bot

I need send to telegram long text with photo but telegram image caption has 200 character limit. 我需要将带有照片的长文本发送到电报中,但电报图像标题不能超过200个字符。 How can send long text with photo using php and bot? 如何使用php和bot发送带有照片的长文本? sendPhoto method has 200 character limit. sendPhoto方法的字符数限制为200。 I see a telegram bot it's send long text and photo see my sample photo. 我看到一个电报机器人,它发送长文本和图片,并查看我的示例照片。

这是发送到Telegrem的样本图像

You can use empty character! 您可以使用空字符!

Just set parse_mode Field to HTML in sendMessage method , then in text Field insert the URL of the image into href 只需在sendMessage方法中将parse_mode字段设置为HTML ,然后在text字段中将图像的URL插入href中

The hyperlink will not be seen when you use empty character : 当您使用空字符时,将不会显示超链接:

<a href="https://www.nafasbekesh.ir/wp-content/uploads/2016/10/img1.jpg">
⁠</a>

Copy the empty character for your own use. 复制空字符供您自己使用。

You can send standard message with parse_mode Markdown or HTML. 您可以使用parse_mode Markdown或HTML发送标准消息。 In text content you need send link to your image. 在文本内容中,您需要发送指向图像的链接。 https://core.telegram.org/bots/api#markdown-style https://core.telegram.org/bots/api#markdown-style

Some words [/start](https://www.google.ru/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png)
ok.
You will see google's logo in the bottom of message. The blue line on the left of the image indicates that it is the parsing contents of the link

You can send text message with Markdown Style or HTML Style and use inline URLs. 您可以使用Markdown样式HTML样式发送文本消息 ,并使用嵌入式URL。

sample of inline URLs format: 内联网址格式示例:

[inline URL](http://www.example.com/)

You can use ( ALT + NUMPAD characters ) for hide link text. 您可以使用( ALT + NUMPAD个字符 )隐藏链接文本。

For Example [ALT + 255] create non-breakable space which you can use this. 例如,[ALT + 255]创建不可破坏的空间,您可以使用它。

[ ](http://www.example.com/)

If you have many link in the text, Put your image link at the beginning of the text. 如果文本中有很多链接,请将图像链接放在文本的开头。

You can use (ALT + NUMPAD characters) for hide link text. 您可以使用(ALT + NUMPAD个字符)隐藏链接文本。

For Example [ALT + 255] create non-breakable space which you can use this. 例如,[ALT + 255]创建不可破坏的空间,您可以使用它。

but in this case i receved the following error 但在这种情况下,我收到以下错误

PHP Warning: : failed to open stream: HTTP request failed! PHP警告::无法打开流:HTTP请求失败! HTTP/1.1 400 Bad Request HTTP / 1.1 400错误请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM