So, I am trying to understand what is the difference with my string now that it has arrived through a FORM POST instead of a string which i declare in the variable inside my code, when I echo
the POST variable it is the correct string. When it reaches Telegram, the new line is no longer interpreted as a new line.
This is part of my code and it works as expected:
$dynamicMessage = "Line One nLineTwo";
// Parameters to be sent in the request
$params = array(
'chat_id' => $chatId,
'text' => $dynamicMessage,
'parse_mode' => 'HTML'
);
Output in my Telegram chat from my Telegram Bot:
Line One
LineTwo
Now, I switch to POST to this and assign to the variable, it does not work as expected:
$dynamicMessage = trim($_POST["updatemessage"]);
// Parameters to be sent in the request
$params = array(
'chat_id' => $chatId,
'text' => $dynamicMessage,
'parse_mode' => 'HTML'
);
Output in my Telegram chat from my Telegram Bot:
Line One nLineTwo
Tazz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.