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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -