using htmldom to find meta tags (incomplete code)

7:25 am, May 23, 2018
$html = $functions->cache_results($id = uniqid(), $url = $link, $cache_length_hours = 1, $use_simple_html = true); $link_title = $html->find("title",0)->plaintext; $keywords_object = $html->find("meta[name=keywords]",0); if(is_object($keywords_object)) { $link_keywords = $keywords_object->getAttribute('content'); } else { $link_keywords = ""; } $desc_object = $html->find("meta[name=description]",0); if(is_object($desc_object)) { $link_description = $desc_object->getAttribute('content'); } else { $link_description = ""; } $page_content .= " \$link_title:$link_title
\$link_keywords:$link_keywords
\$link_description:$link_description
";

Code

html
css
js
scripts

Download & Run

Download File Run Demo Re-load Preview

Preview

lSQ2p