Source code for file /openid/Services/Yadis/HTTPFetcher.php
Documentation is available at HTTPFetcher.php
* This module contains the HTTP fetcher interface
* LICENSE: See the COPYING file included in this distribution.
* @copyright 2005 Janrain, Inc.
* @license http://www.gnu.org/copyleft/lesser.html LGPL
$headers =
null, $body =
null)
$this->final_url =
$final_url;
$this->headers =
$headers;
* This class is the interface for HTTP fetchers the Yadis library
* uses. This interface is only important if you need to write a new
* fetcher for some reason.
class Services_Yadis_HTTPFetcher {
var $timeout =
20; // timeout in seconds.
* Return whether a URL should be allowed. Override this method to
* conform to your local policy.
* By default, will attempt to fetch any http or https URL.
function allowedURL($url)
return $this->URLHasAllowedScheme($url);
* Is this an http or https URL?
function URLHasAllowedScheme($url)
function _findRedirect($headers)
foreach ($headers as $line) {
if (strpos($line, "Location: ") ===
0) {
* Fetches the specified URL using optional extra headers and
* returns the server's response.
* @param string $url The URL to be fetched.
* @param array $extra_headers An array of header strings
* (e.g. "Accept: text/html").
* @return mixed $result An array of ($code, $url, $headers,
* $body) if the URL could be fetched; null if the URL does not
* pass the URLHasAllowedScheme check or if the server's response
function get($url, $headers)