0

i need a regex for ectract meta title, description

exg:
<meta name="description" content="xxxxx">
and
<meta name="Description" content="xxxxx">
and
<meta name="Descriptions" content="xxxxx">
and
<Meta name="Descriptions" content="xxxxx">
and
<META NAME="Description" content="xxxxx">

i want to extract all type od descrptions, same also meta title

2
Contributors
4
Replies
18
Views
3 Years
Discussion Span
Last Post by diafol
0

thanks your reply, its not getting uppercase meta tage
eg:
<META NAME="DESCRIPTION"
<meta name="Descriptions"

0

What you can do is strtolower the keys in the $tags array and check those.

function cleanMeta($tags)
{
    $keys = array_map('strtolower', array_keys($tags));
    $values = array_values($tags);
    return array_combine($keys, $values);
}

$tags = cleanMeta(get_meta_tags('hangman.php'));

print_r($tags);

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.