如何在电报机器人中创建 link

how to create link in telegram bot

我正在设计电报机器人。我想显示一些链接,例如

1- wkpviana

2- vianahosting

当用户点击它时,打开

http://wkpviana.net 
http://vianahosting.ir

在浏览器中。 如何在 php 中创建它? 我的部分代码是:

<?php
...
$sLink = "";
foreach($Links as $Row){
    $sLink .= "<a href='".$Row->link_url."'>".$Row->link_name."</a>";
}
$Text = $sLink;
...
$URL = "https://api.telegram.org/bot".$Token."/sendMessage?chat_id=".$ChatID."&text=".$Text."&reply_markup=".json_encode($KB);
file_get_contents($URL);
?>

您似乎在尝试发送带有 <a> 标签的链接,效果很好,但需要您使用 parse_mode=html 参数,如记录 here.

我想它看起来有点像这样:

$URL = "https://api.telegram.org/bot".$Token."/sendMessage?chat_id=".$ChatID."&text=".$Text."&parse_mode=HTML&reply_markup=".json_encode($KB);