P
P
pink2floyd2016-09-24 00:52:26
PHP
pink2floyd, 2016-09-24 00:52:26

How to make a line break in the message that the bot sends?

Everywhere they say that /n /r/n helps, but I don’t have an underscore instead of them 4fede07b0b4a414699821ed4248c1fbb.pngwith single quotes.
With double
a617da1453de4dc7b98ec5bc9aacd414.png
Send code:
public function sendMessage($api, $chat_id, $message) {
file_get_contents($api . '/sendMessage?chat_id=' . $chat_id . '&text=' . $message);
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pink2floyd, 2016-09-24
@pink2floyd

Answer found, I stupidly removed urlencode() when sending a message
public function sendMessage($api, $chat_id, $message) {
file_get_contents($api . '/sendMessage?chat_id=' . $chat_id . '&text=' . urlencode ($message));
}
Should be like this

A
Andrew, 2016-09-24
@ntzch

Perhaps the PHP_EOL constant will help? It just automatically substitutes the necessary line break depending on which axis it is used in, the solution is more universal. Well, in general, you need at least a piece of code where you have a problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question