Verification

After loading a XRD file, you should make sure that it really describes the resource/URL you are looking for. describes() checks both the subject and alias tags:

<?php
require_once 'XML/XRD.php';
$xrd = new XML_XRD();
$xrd->loadFile('http://example.org/.well-known/host-meta');
if (!
$xrd->describes('http://example.org/')) {
    die(
'XRD document is not the correct one for http://example.org/');
}
?>