Answer the question
In order to leave comments, you need to log in
How to insert link into php array?
Hello everyone,
I made a telegram bot based on a video lesson from the Internet, which informs about applications from a site in a group.
There was such a question, now the phone number is in plain text, how to make it a link so that when you click on it, dialing opens?
I tried to insert the tag <a>
, but the requests immediately stopped coming, i.e. everything broke
. The code itself
<?php
session_start();
$recepient = "*";
$token = "*";
$chat_id = "*";
$name = trim($_POST["user_name"]);
$phone = trim($_POST["user_phone"]);
$email = trim($_POST["user_email"]);
$form = trim($_POST["form_name"]);
$text = trim($_POST["user_message"]);
$browser=$_SERVER["HTTP_USER_AGENT"];
$refferer = $_SERVER['HTTP_REFERER'];
list($url) = explode('?', $_SERVER['HTTP_REFERER']);
$date = date("d.m.y", strtotime('+2 hour'));
$time = date("H:i", strtotime('+2 hour'));
$arr = array(
'Форма: ' => $form,
'Имя: ' => $name,
'Телефон: ' => $phone,
'Почта: ' => $email,
'Сообщение: ' => $text,
'Адресс страницы: ' => $url,
'Дата: ' => $date,
'Время: ' => $time,
);
foreach($arr as $key => $value) {
$txt .= "<b>".$key."</b> ".$value."%0A";
};
$pagetitle = "Заявка с сайта";
$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}","r");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question