diff --git a/OpenGraph.php b/OpenGraph.php index af2e7b6..0ec8a0f 100644 --- a/OpenGraph.php +++ b/OpenGraph.php @@ -97,14 +97,14 @@ static private function _parse($HTML) { foreach ($tags AS $tag) { if ($tag->hasAttribute('property') && - strpos($tag->getAttribute('property'), 'og:') === 0) { + strncmp($tag->getAttribute('property'), 'og:', 3) === 0) { $key = strtr(substr($tag->getAttribute('property'), 3), '-', '_'); $page->_values[$key] = $tag->getAttribute('content'); } //Added this if loop to retrieve description values from sites like the New York Times who have malformed it. if ($tag ->hasAttribute('value') && $tag->hasAttribute('property') && - strpos($tag->getAttribute('property'), 'og:') === 0) { + strncmp($tag->getAttribute('property'), 'og:', 3) === 0) { $key = strtr(substr($tag->getAttribute('property'), 3), '-', '_'); $page->_values[$key] = $tag->getAttribute('value'); }