1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- class LRDDMethod_WebFinger extends LRDDMethod
- {
-
- public function discover($uri)
- {
- if (!Discovery::isAcct($uri)) {
- throw new Exception('Bad resource URI: '.$uri);
- }
- list($user, $domain) = explode('@', parse_url($uri, PHP_URL_PATH));
- if (!filter_var($domain, FILTER_VALIDATE_IP)
- && !filter_var(gethostbyname($domain), FILTER_VALIDATE_IP)) {
- throw new Exception('Bad resource host.');
- }
- $link = new XML_XRD_Element_Link(
- Discovery::LRDD_REL,
- 'https://' . $domain . '/.well-known/webfinger?resource={uri}',
- Discovery::JRD_MIMETYPE,
- true);
- return array($link);
- }
- }
|