whatsapi - How send text message with link in WhatsApp using what's API chat -
i using whatsapp chat in php send messages. php script work fine, url inside text message doesn't render clickable link. shown plain text instead.
$msg= "hello !. \n http://example.com ";
what doing wrong?
your php variable seen plain text because pure string, nothing more. goal let clickable link , guess shown in webpage. in case, should put html code inside variable.
starting code, valid solution can this:
$msg= "hello !. \n <a href='http://example.com "'>click here</a>;
otherwise, can implement function:
function make_links_clickable($text){ return preg_replace('!(((f|ht)tp(s)?://)[-a-za-zа-яА-Я()0-9@:%_+.~#?&;//=]+)!i', '<a href="$1">$1</a>', $text);
}
Comments
Post a Comment