Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples how to generate XRD files for webfinger
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
<?php | |||
/** | |||
* Generates a .well-known/host-meta file that's described | |||
* in "RFC 6415: Web Host Metadata". | |||
* | |||
* @author Christian Weiske <cweiske@php.net> | |||
* @link http://tools.ietf.org/html/rfc6415 | |||
*/ | |||
require_once 'XML/XRD.php'; | |||
$x = new XML_XRD(); | |||
|
|||
$x->subject = 'example.org'; | |||
$x->aliases[] = 'example.com'; | |||
$x->links[] = new XML_XRD_Element_Link( | |||
'lrdd', 'http://example.org/gen-lrdd.php?a={uri}', | |||
'application/xrd+xml', true | |||
); | |||
|
|||
echo $x->toXML(); | |||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
<?php | |||
/** | |||
* Generate a LRDD file that contains information about a user. | |||
* | |||
* @author Christian Weiske <cweiske@php.net> | |||
* @link http://tools.ietf.org/html/draft-hammer-discovery-06 | |||
*/ | |||
require_once 'XML/XRD.php'; | |||
$x = new XML_XRD(); | |||
$x->subject = 'user@example.org'; | |||
|
|||
//add link to the user's OpenID | |||
$x->links[] = new XML_XRD_Element_Link( | |||
'http://specs.openid.net/auth/2.0/provider', | |||
'http://id.example.org/user' | |||
); | |||
//add link to user's home page | |||
$x->links[] = new XML_XRD_Element_Link( | |||
'http://xmlns.com/foaf/0.1/homepage', | |||
'http://example.org/~user/' | |||
); | |||
|
|||
echo $x->toXML(); | |||
?> |