Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcAuthenticationUrl

Authentication::ezcAuthenticationUrl

Class ezcAuthenticationUrl

Class which provides a methods for handling URLs.

Source for this file: /Authentication/src/url/url.php

Version:   //autogen//

Method Summary

public static string appendQuery( $url , $key , $value )
Appends a query value to the provided URL and returns the complete URL.
public static string buildUrl( $parts )
Creates a string URL from the provided $parts array.
public static true fetchQuery( $url , $key )
Fetches the value of key $key from the query of the provided URL.
public static void getUrl( $url , [ $method = 'GET'] , [ $type = 'text/html'] )
Retrieves the headers and contents of $url using the HTTP method $method (GET, HEAD, POST), with an optional Accept $type (default 'text/html').
public static string normalize( $url )
Normalizes the provided URL.
public static array(string=>mixed) parseQueryString( $str )
Parses the provided string and returns an associative array structure.

Methods

appendQuery

static string appendQuery( string $url , string $key , string $value )

Appends a query value to the provided URL and returns the complete URL.

Parameters:
Name Type Description
$url string The URL to append a query value to
$key string The query key to append to the URL
$value string The query value to append to the URL

buildUrl

static string buildUrl( $parts )

Creates a string URL from the provided $parts array.

The format of the $parts array is similar to the one returned by parse_url(), with the 'query' part as an array(key=>value) (obtained with the function parse_str()).

Parameters:
Name Type Description
$parts array(string=>mixed) The parts of the URL

fetchQuery

static true fetchQuery( string $url , string $key )

Fetches the value of key $key from the query of the provided URL.

Parameters:
Name Type Description
$url string The URL from which to fetch the query value
$key string The query key for which to get the value

getUrl

static void getUrl( string $url , [string $method = 'GET'] , [string $type = 'text/html'] )

Retrieves the headers and contents of $url using the HTTP method $method (GET, HEAD, POST), with an optional Accept $type (default 'text/html').

Parameters:
Name Type Description
$url string Then URL to retrieve
$method string HTTP method to use, default GET
$type string Accept type to use, eg. 'application/xrds+xml'

normalize

static string normalize( string $url )

Normalizes the provided URL.

The operations performed on the provided URL:

  • trim
  • add 'http://' in front if it is missing
Parameters:
Name Type Description
$url string The URL to normalize

parseQueryString

static array(string=>mixed) parseQueryString( array(string=>mixed) $str )

Parses the provided string and returns an associative array structure.

It implements the functionality of the PHP function parse_str(), but without converting dots to underscores in parameter names.

Example:

  1.  $str = 'foo[]=bar&openid.nonce=123456';
  2.  
  3.  parse_str( $str, $params );
  4.  $params = ezcUrlTools::parseQuery( $str );

In the first case (parse_str()), $params will be:

  1.  array( 'foo' => array( 'bar' ), 'openid_nonce' => '123456' );

In the second case (ezcUrlTools::parseQueryString()), $params will be:

  1.  array( 'foo' => array( 'bar' ), 'openid.nonce' => '123456' );

The same function is defined in ezcUrlTools in the Url component.

Parameters:
Name Type Description
$str array(string=>mixed) The string to parse
Documentation generated by phpDocumentor 1.4.3