Net_WebFinger
[ class tree: Net_WebFinger ] [ index: Net_WebFinger ] [ all elements ]

Class: Net_WebFinger

Source Location: /Net_WebFinger-0.4.0/src/Net/WebFinger.php

Class Overview


PHP WebFinger client. Performs discovery and returns a result.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 39]
PHP WebFinger client. Performs discovery and returns a result.

Fetches the well-known WebFinger URI https://example.org/.well-known/webfinger?resource=acct:user@example.org

If that fails, the account's host's .well-known/host-meta file is fetched, then the file indicated by the "lrdd" type, as specificed by RFC 6415.

  1.  require_once 'Net/WebFinger.php';
  2.  $wf = new Net_WebFinger();
  3.  $react $wf->finger('user@example.org');
  4.  echo 'OpenID: ' $react->openid . "\n";



[ Top ]


Class Variables

$cache =

[line 62]

Cache object to use (PEAR Cache package).
  • Access: protected

Type:   Cache


[ Top ]

$fallbackToHttp =  false

[line 48]

Retry with HTTP if the HTTPS webfinger request fails.

This is not allowed by the webfinger specification, but may be helpful during development.

  • Access: public

Type:   boolean


[ Top ]

$httpClient =

[line 55]

HTTP client to use.
  • Access: protected

Type:   HTTP_Request2


[ Top ]



Method Detail

finger   [line 102]

Net_WebFinger_Reaction finger( string $url)

Finger a email address like identifier - get information about it.

If an error occurs, you find it in the reaction's $error property.


Parameters:

string   $url   —  Identification URL. Full URLs and schema-less ones supported. When the schema is missing, "acct:" is used.

[ Top ]

getIdentifierAndHost   [line 148]

Net_WebFinger_Reaction|array getIdentifierAndHost( string $url)

Convert a single URL string to an identifier and its host.

Automatically adds acct: if it's missing.

  • Return: Error reaction or array with identifier and host as values
  • Access: protected

Parameters:

string   $url   —  Some URL, with or without scheme

[ Top ]

isHttps   [line 381]

boolean isHttps( string $url)

Check whether the URL is an HTTPS URL.
  • Return: True if it's a HTTPS url
  • Access: protected

Parameters:

string   $url   —  URL to check

[ Top ]

loadHostMeta   [line 237]

Net_WebFinger_Reaction loadHostMeta( string $host)

Load the host's .well-known/host-meta XRD file.

The XRD is stored in the reaction object's $source['host-meta'] property, and any error that is encountered in its $error property.

When the XRD file cannot be loaded, this method returns false.


Parameters:

string   $host   —  Hostname to fetch host-meta file from

[ Top ]

loadLrdd   [line 289]

Net_WebFinger_Reaction loadLrdd( string $identifier, string $host, XML_XRD $hostMeta)

Loads the user XRD file for a given identifier

The XRD is stored in the reaction object's $userXrd property, any error is stored in its $error property.


Parameters:

string   $identifier   —  E-mail address like identifier ("user@host")
string   $host   —  Hostname of $identifier
object   $hostMeta   —  host-meta XRD object

[ Top ]

loadWebfinger   [line 198]

Net_WebFinger_Reaction loadWebfinger( string $identifier, string $host)

Loads the webfinger JRD file for a given identifier

Parameters:

string   $identifier   —  E-mail address like identifier ("user@host")
string   $host   —  Hostname of $identifier

[ Top ]

loadXrd   [line 429]

boolean loadXrd( string $url)

Loads the XRD file from the given URL.

Sets $react->error when loading fails

  • Return: True if loading data succeeded, false if not
  • Access: protected

Parameters:

string   $url   —  URL to fetch

[ Top ]

loadXrdCached   [line 395]

Net_WebFinger_Reaction loadXrdCached( string $url)

Load an XRD file and caches it.

Parameters:

string   $url   —  URL to fetch

[ Top ]

mergeHostMeta   [line 341]

void mergeHostMeta( Net_WebFinger_Reaction $react, Net_WebFinger_Reaction $hostMeta)

Merges some properties from the hostMeta file into the reaction object
  • Access: protected

Parameters:

object   $react   —  Target reaction object
object   $hostMeta   —  Source hostMeta object

[ Top ]

setCache   [line 85]

void setCache( Cache $cache)

Set a cache object that's used to buffer XRD files.
  • Access: public

Parameters:

Cache   $cache   —  PEAR cache object

[ Top ]

setHttpClient   [line 73]

void setHttpClient( HTTP_Request2 $httpClient)

Set a HTTP client object that's used to fetch URLs.

Useful to set an own user agent.

  • Access: public

Parameters:

object   $httpClient   —  HTTP_Request2 instance

[ Top ]

verifyDescribes   [line 361]

void verifyDescribes( Net_WebFinger_Reaction $react, string $account)

Verifies that the reaction object is about the given account URL.

Sets the error property in the reaction object.

  • Access: protected

Parameters:

object   $react   —  Reaction object to check
string   $account   —  acct: URL that the reaction should be about

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:57:48 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.