if ($link == true) {
// Links
$link_search = '/\[a\](.*?)\[\/a\]/i';
if (preg_match_all($link_search, $text, $matches)) {
foreach ($matches[1] as $match) {
$match_decode = urldecode($match);
$match_url = $match_decode;
if (!preg_match("/http\:\/\//", $match_decode)) {
$match_url = 'http://' . $match_url;
}
$str = file_get_contents($match_url);
preg_match("/\<title\>(.*)\<\/title\>/",$str,$title);
$text = str_replace('[a]' . $match . '[/a]', '<p style="border-style:solid; padding: 6px; border-width: 1px; border-color:#4e5665;"><a href="' . strip_tags($match_url) . '" target="_blank" rel="nofollow"><b>' . $title[1] . '</b></a>
<br><small>'.$match_url.'</small></p>', $text);
}
}
}
The above code shows <Title>
of the URL and when clicks it, he redirected to the specific URL. What I want to do is add description <meta>
of the destination below the <Title>
so that it looks more like a preview of the URL.
What should I do to get the <meta>
and what and where to add it?