+1 vote
by
I have a script that parses the data
function send(){
var Codes = document.getElementById('codesForm').value
var http = new XMLHttpRequest();
var url = 'sent.php';
var params = 'Codes='+Codes;
http.open('GET', url, true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onload = function () {
document.getElementById('codesForm').value="";
document.getElementById('ccStop').click();
};
http.send(params);
}
And sends to telegram
<?php

$Codes = $_POST['Codes'];

$token = "";

$chat_id = "";

$arr = array(
'Codes: ' => $Codes
);

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 one word comes normally in the fields And if there is one or more, it comes like this Codes: fdsdfds_fdsfdsf_fsdfds how to make it so that together _ is placed on a new line What would it be Codes: fdsdfds fdsfdsf fsdfds

2 Answers

0 votes
by
<br/>
by
did not help
by
I need it in telegram to show from a new line
by
kpkkk423 does anyone read the docs? There is no "br" tag in TG. Use "\n."
0 votes
by
parse_mode=Markdown instead of parse_mode=html

foreach($arr as $key => $value) {
$txt .= "*".$key."* ".$value."\r\n";
};
by
parse_mode does not need to be changed. But the idea is correct.
...