O
O
Oslar2018-06-27 10:42:11
PHP
Oslar, 2018-06-27 10:42:11

PHP code error when I connect the telegram bot to the site, how to destroy it?

It turns out that I connected a telegram bot that accepts applications from the site.
Everything on this site is working properly.
I then uploaded these files to the customer's hosting . Here is the site and it does not work there.
Here is a file with such errors that I create on the hosting of the customer

[27-Jun-2018 10:21:20 Europe/Moscow] PHP Warning:  fopen(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /var/home/k41863/public_html/unique-life.kiev.ua/email.php on line 24
[27-Jun-2018 10:21:20 Europe/Moscow] PHP Warning:  fopen(https://[email protected]%0A<b>Тема</b> Cтать владельцем франшизы%0A): failed to open stream: no suitable wrapper could be found in /var/home/k41863/public_html/unique-life.kiev.ua/email.php on line 24

Here is my php file
<?php

/* https://api.telegram.org/bot598343425:AAFbHOmQrct_99vpIYdyPpxDZ9TExB-TECM/getUpdates,
где, XXXXXXXXXXXXXXXXXXXXXXX - токен вашего бота, полученный ранее */

$name = $_POST['user_name'];
$phone = $_POST['user_phone'];
$email = $_POST['user_email'];
$theme = $_POST['user_theme'];
$token = "598343425:AAFbHOmQrct_99vpIYdyPpxDZ9TExB-TECM";
$chat_id = "-267401780";
$arr = array(
  'Имя пользователя: ' => $name,
  'Телефон: ' => $phone,
  'Email' => $email,
  'Тема' => $theme
  
);

foreach($arr as $key => $value) {
  $txt .= "<b>".$key."</b> ".$value."%0A";
};

$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}","r");

if ($sendToTelegram) {
  header('Location: thanks.html');
} else {
  echo "Error";
}
?>

How can I fix this error. Works on one host, not on the other.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-06-27
@Oslar

fopen(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0

A clear guide to action. Go to settings and change allow_url_fopen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question