yii\authclient\OpenId::extractHtmlTagValue PHP Method

extractHtmlTagValue() protected method

Scans content for / tags and extract information from them.
protected extractHtmlTagValue ( string $content, string $tag, string $matchAttributeName, string $matchAttributeValue, string $valueAttributeName ) : string | boolean
$content string HTML content to be be parsed.
$tag string name of the source tag.
$matchAttributeName string name of the source tag attribute, which should contain $matchAttributeValue
$matchAttributeValue string required value of $matchAttributeName
$valueAttributeName string name of the source tag attribute, which should contain searched value.
return string | boolean searched value, "false" on failure.
    protected function extractHtmlTagValue($content, $tag, $matchAttributeName, $matchAttributeValue, $valueAttributeName)
    {
        preg_match_all("#<{$tag}[^>]*{$matchAttributeName}=['\"].*?{$matchAttributeValue}.*?['\"][^>]*{$valueAttributeName}=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1);
        preg_match_all("#<{$tag}[^>]*{$valueAttributeName}=['\"](.+?)['\"][^>]*{$matchAttributeName}=['\"].*?{$matchAttributeValue}.*?['\"][^>]*/?>#i", $content, $matches2);
        $result = array_merge($matches1[1], $matches2[1]);
        return empty($result) ? false : $result[0];
    }