How to use the package

At first, you need to include the main XML_XRD file and create a new XML_XRD object:

<?php
require_once 'XML/XRD.php';
$xrd = new XML_XRD();
?>

When that's done, you load the XRD file or string, then verify if the resource is really the resource you wanted to load and then access the links and the properties of the XRD object.

Also read the sections about error handling and XRD creation.

Fetching LRDD URI from host-meta

<?php
require_once 'XML/XRD.php';
$xrd = new XML_XRD();
try {
    
$xrd->loadFile('http://cweiske.de/.well-known/host-meta');
} catch (
XML_XRD_Exception $e) {
    die(
'Loading XRD file failed: '  $e->getMessage());
}
$link $xrd->get('lrdd''application/xrd+xml');
if (
$link === null) {
    die(
'No LRDD link found');
}
$template $link->template;
$lrddUri str_replace('{uri}'urlencode('acct:cweiske@cweiske.de'), $template);
echo 
'URL with infos about cweiske@cweiske.de is ' $lrddUri "\n";
?>