WebsiteParser::getMetaTags( boolean $grab = false )

Extract all metatags sources from grabbed contents

Description

Parameters

$grab

(Optional) , flag to perform real time grab or use class content

Default value: false

Return

(array,) an array of extracted metatags

Source

File: bp-activity/vendors/website-parser/website_parser.php

    public function getMetaTags($grab = false)
    {
        $metatags = array();

        if ($grab)
            $this->grabContent();

        if (!is_null($this->content)) {

            preg_match_all($this->metatags_expression_1, $this->content, $match_tags);

            if (isset($match_tags[2]) && count($match_tags[2])) {
                foreach ($match_tags[2] as $key => $match_tag) {

                    $key = trim($match_tags[1][$key]);
                    $match_tag = trim($match_tag);

                    if ($match_tag) {
                        $metatags[] = array($key, $match_tag);
                    }
                }
            }

            preg_match_all($this->metatags_expression_2, $this->content, $match_tags_2);

            if (isset($match_tags_2) && count($match_tags_2)) {
                foreach ($match_tags_2[0] as $key => $match_tag) {
                        $metatags[] = array( trim( $match_tags_2[2][$key] ), trim( $match_tags_2[1][$key] ) );
                }
            }
        }

        return $metatags;
    }

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.