SimpleSAML_Metadata_SAMLParser::parseFile PHP Method

parseFile() public static method

This function parses a file which contains XML encoded metadata.
public static parseFile ( string $file ) : SimpleSAML_Metadata_SAMLParser
$file string The path to the file which contains the metadata.
return SimpleSAML_Metadata_SAMLParser An instance of this class with the metadata loaded.
    public static function parseFile($file)
    {
        $data = \SimpleSAML\Utils\HTTP::fetch($file);
        try {
            $doc = \SAML2\DOMDocumentFactory::fromString($data);
        } catch (\Exception $e) {
            throw new Exception('Failed to read XML from file: ' . $file);
        }
        return self::parseDocument($doc);
    }