PHPackages                             pear/net\_webfinger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. pear/net\_webfinger

AbandonedArchivedLibrary[API Development](/categories/api)

pear/net\_webfinger
===================

WebFinger implementation for PHP

v0.4.1(2y ago)340961LGPL-3.0-or-laterPHP

Since Jul 17Pushed 2y ago2 watchersCompare

[ Source](https://github.com/pear/Net_WebFinger)[ Packagist](https://packagist.org/packages/pear/net_webfinger)[ Docs](http://pear.php.net/package/Net_Webfinger)[ RSS](/packages/pear-net-webfinger/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (4)Versions (3)Used By (1)

Net\_WebFinger
==============

[](#net_webfinger)

WebFinger client library for PHP.

Discover meta data about users by just their email address. Discoverable data may be the user's OpenID, profile page URL, link to portable contacts, hcard, foaf and other user pages.

Distributed social networks use WebFinger to distribute public encryption keys, OStatus and Salmon URLs.

Package supports Webfinger ([RFC 7033](http://tools.ietf.org/html/rfc7033)) and can fall back to [RFC 6415](http://tools.ietf.org/html/rfc6415) (host-meta + lrdd).

Contents

- [Error handling](#error-handling)
    - [Error handling example](#error-handling-example)
- [Examples](#examples)
    - [OpenID discovery](#openid-discovery)
    - [Simple link access](#simple-link-access)
    - [Accessing all links](#accessing-all-links)
    - [Caching](#caching)
    - [Security](#security)
    - [Custom HTTP adapter](#custom-http-adapter)
- [Testing](#testing)
- [Links](#links)
    - [References](#references)
    - [Alternate implementations](#alternate-implementations)

[Error handling](#id15)
-----------------------

[](#error-handling)

The package does not throw any exceptions. Technically, `Net_WebFinger_Error` objects are exceptions, but they are only set as `$error` property in the `Net_WebFinger_Reaction` object.

You can ignore them completely if you're just out to get the data.

Sometimes it's even necessary to ignore the data. Yahoo! for example has a `host-meta` file, but no LRDD files. The OpenID provider URL already noted in `host-meta`, so even though fetching the LRDD file fails, information about the OpenID provider is available.

### [Error handling example](#id16)

[](#error-handling-example)

The `Net_WebFinger_Reaction` object has an `$error` property that contains an exception with error message and code. It often even has a previous exception object with more underlying details:

```

```

[Examples](#id17)
-----------------

[](#examples)

### [OpenID discovery](#id18)

[](#openid-discovery)

```

```

### [Simple link access](#id19)

[](#simple-link-access)

Some common link relations have a short name in `Net_WebFinger`. Those short names can be used to access them more easily:

```

```

Currently supported short names:

- `contacts`
- `hcard`
- `openid`
- `profile`
- `xfn`

See the list `$shortNameMap` in class `Net_WebFinger_Reaction`.

### [Accessing all links](#id20)

[](#accessing-all-links)

You can use `foreach` on the reaction object to get all links:

```

```

### [Caching](#id21)

[](#caching)

With caching, the retrieved files will be stored locally which leads to faster lookup times when the same identifier (email address) is loaded again, and when another identifier on the same host is retrieved.

```

```

Note: PEAR's Cache\_Lite package does not support per-item lifetimes, so we cannot use it:

### [Security](#id22)

[](#security)

All files will be retrieved via SSL when possible, with fallback to normal HTTP.

The fallback for pure webfinger files does only happen when `$fallbackToHttp`is enabled. Fallback for `host-meta` and LRDD files is always on.

The XRD subject is also verified. When it does not match the host name of the email address, then the error object is set.

```
