Итак, я настраиваю свой PHP-скрипт для отправки сообщения из моей контактной формы в мой телеграммный чат с ботом.Google App Engine с API Telegram Bot с помощью PHP-вывода без пробелов
Вот код PHP скрипт:
<?php
if(trim($_POST["gotcha"]) !== "") {
header("Location: https://example.com/");
} else {
if(isset($_POST["name"]) && isset($_POST["email"]) && isset($_POST["subject"]) && isset($_POST["content"])) {
$wholeMessage = "Name:"." ".$_POST["name"]." "."|"." "."Email:"." ".$_POST["email"]." "."|"." "."Subject:"." ".$_POST["subject"]." "."|"." "."Message:"." ".$_POST["content"];
$data = "https://api.telegram.org/bot<BOTID>/sendmessage?chat_id=<CHATID>&text=".$wholeMessage;
$response = file_get_contents($data);
header("Location: https://example.com/thanks/");
} else {
header("Location: https://example.com/");
}
}
?>
В результате на моем Телеграмма чате:
Name:firstname|Email:[email protected]|Subject:test|Message:testhttps://google.commouseappletest
Использование %nbsp;
только выход:
Name:
ничего другого выводимый.
Как вы можете видеть, все пробелы исчезли. Что-то не так с моим кодом?
Благодаря