I'm using cURL to fetch META Description of a web page. Here's the fraction of the code:
$metas = $doc->getElementsByTagName('meta');
for ($i = 0; $i < $metas->length; $i++)
{
$meta = $metas->item($i);
$metaname = $meta->getAttribute('name');
if($metaname == 'description')
$description = $meta->getAttribute('content');
}
<META name="description" content="<?php echo $description; ?>" />
It works ok, but not perfectly. The problem happens when the character case of an element's attribute or value is different from what was defined. For example, the code above would not output the content values if the META attribute "name" or its value "description" is uppercase(NAME,DESCRIPTION) or capitalized(Name,Description).
How do I work around this without too much codes?