How to format Whatsapp Web Message ?
I trying replacing tags like this :
$nl = "%0D%0A";
$space = "%20";
$MSG = nl2br($MSG);
$MSG = str_replace( array("<b>","<bold>","</b>","</bold>"), array("*","*","*","*"), $MSG);
$MSG = str_replace( array(" ","<br>","\n", "\r\n"), array($space,$nl,$nl,$nl), $MSG);
I tried using urlencode, htmlspecialchars and nothing.
I´m receiving on https://api.whatsapp.com/send?phone=XXX&text=MSG a totally unformated and with a lot of chars string. Like this :
%F0%9F%94%94%2A...
My Answer:
"\n";$bold = "*";$italic = "_";$strikethrough = "~";$code = "
";$message = "This is a $boldbold$bold message with $italicitalic$italic and $strikethroughstrikethrough$strikethrough text. Also, here is some $codecode$code formatting.";echo $message;Output:This is a *bold* message with _italic_ and ~strikethrough~ text. Also, here is some
code formatting.
Rate this post
3 of 5 based on 4563 votesComments