Answer the question
In order to leave comments, you need to log in
PHP script not working on website?
Greetings to everyone, I wrote a site, purely to test it, designed a script at the top of the code so that it would send messages to a telegram conversation through a bot, that the user went to the site / followed the link, but he does not send them, while the form that you can see below, works perfectly through the same token and chat id, just through a separate .php as you can see. I would like to ask for help, thanks in advance)
ps Code file in .php format.
upd Bot token and chat id ($to) values have been changed to avoid problems.
<?php
$BOT_TOOKEN = 'ASSgdfsagds2312092412';
$to = -111111111;
$message = 'that you need ';
$parameters = array('chat_id' => $to, 'parse_mode' => 'HTML', "text" => $message);
$url = "https://api.telegram.org/bot" . trim($BOT_TOOKEN) . '/sendMessage?' . http_build_query($parameters);
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
$response = curl_exec($handle);
?>
<html>
<head>
<title>vedrok</title>
</head>
<body>
<form action="telegram.php" method="POST">
<input type="tel" name="telephone"><br>
<input type="text" name="name"><br>
<input type="add" name="adress"><br>
<input type="tel" name="number">
<button type="submit">OK</button>
</form>
</body>
</html>
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