API Documentation

Uri/Http.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Uri
version
$Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Uri_Http

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Uri_Http

Extends from
Zend_Uri
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Uri
uses
Zend_Uri
Constants
CHAR_ALNUM
CHAR_MARK
CHAR_RESERVED
CHAR_SEGMENT
CHAR_UNWISE
Properties
$_username
$_password
$_host
$_port
$_path
$_query
$_fragment
$_regex
Methods
__construct
fromString
_parseUri
getUri
valid
getUsername
validateUsername
setUsername
getPassword
validatePassword
setPassword
getHost
validateHost
setHost
getPort
validatePort
setPort
getPath
validatePath
setPath
getQuery
getQueryAsArray
validateQuery
addReplaceQueryParameters
removeQueryParameters
setQuery
getFragment
validateFragment
setFragment

Description

HTTP(S) URI handler

Constants

CHAR_ALNUM

 CHAR_ALNUM = 'A-Za-z0-9'

Character classes for validation regular expressions

Details

value
A-Za-z0-9

CHAR_MARK

 CHAR_MARK = '-_.!~*\'()\[\]'

Details

value
-_.!~*\'()\[\]

CHAR_RESERVED

 CHAR_RESERVED = ';\/?:@&=+$,'

Details

value
;\/?:@&=+$,

CHAR_SEGMENT

 CHAR_SEGMENT = ':@&=+$,;'

Details

value
:@&=+$,;

CHAR_UNWISE

 CHAR_UNWISE = '{}|\\\\^`'

Details

value
{}|\\\\^`

Properties

$_fragment

string $_fragment = ''

HTTP fragment

Details

$_fragment
string
visibility
protected
default
final
false
static
false

$_host

string $_host = ''

HTTP host

Details

$_host
string
visibility
protected
default
final
false
static
false

$_password

string $_password = ''

HTTP password

Details

$_password
string
visibility
protected
default
final
false
static
false

$_path

string $_path = ''

HTTP part

Details

$_path
string
visibility
protected
default
final
false
static
false

$_port

string $_port = ''

HTTP post

Details

$_port
string
visibility
protected
default
final
false
static
false

$_query

string $_query = ''

HTTP query

Details

$_query
string
visibility
protected
default
final
false
static
false

$_regex

array $_regex = 'array'

Regular expression grammar rules for validation; values added by constructor

Details

$_regex
array
visibility
protected
default
array
final
false
static
false

$_username

string $_username = ''

HTTP username

Details

$_username
string
visibility
protected
default
final
false
static
false

Methods

__construct

__construct( string $scheme, string $schemeSpecific ) :

Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI (e.g., example.com/path/to/resource?query=param#fragment)

Arguments
$scheme
string
The scheme of the URI
$schemeSpecific
string
The scheme-specific part of the URI
Details
visibility
protected
final
false
static
false
throws
When the URI is not valid

_parseUri

_parseUri( string $schemeSpecific ) : void

Parse the scheme-specific portion of the URI and place its parts into instance variables.

Arguments
$schemeSpecific
string
The scheme-specific portion to parse
Details
visibility
protected
final
false
static
false
throws
When scheme-specific decoposition fails
throws
When authority decomposition fails

addReplaceQueryParameters

addReplaceQueryParameters( array $queryParams ) : string

Add or replace params in the query string for the current URI, and return the old query.

Arguments
$queryParams
array
Output
string
Old query string
Details
visibility
public
final
false
static
false

fromString

fromString( string $uri ) : Zend_Uri_Http

Creates a Zend_Uri_Http from the given string

Arguments
$uri
string
String to create URI from, must start with 'http://' or 'https://'
Output
Zend_Uri_Http
Details
visibility
public
final
false
static
true
throws
When the given $uri is not a string or does not start with http:// or https://
throws
When the given $uri is invalid

getFragment

getFragment( ) : string|false

Returns the fragment portion of the URL (after #), or FALSE if none.

Output
string|false
Details
visibility
public
final
false
static
false

getHost

getHost( ) : string

Returns the domain or host IP portion of the URL, or FALSE if none.

Output
string
Details
visibility
public
final
false
static
false

getPassword

getPassword( ) : string

Returns the password portion of the URL, or FALSE if none.

Output
string
Details
visibility
public
final
false
static
false

getPath

getPath( ) : string

Returns the path and filename portion of the URL, or FALSE if none.

Output
string
Details
visibility
public
final
false
static
false

getPort

getPort( ) : string

Returns the TCP port, or FALSE if none.

Output
string
Details
visibility
public
final
false
static
false

getQuery

getQuery( ) : string

Returns the query portion of the URL (after ?), or FALSE if none.

Output
string
Details
visibility
public
final
false
static
false

getQueryAsArray

getQueryAsArray( ) : array

Returns the query portion of the URL (after ?) as a key-value-array. If the query is empty an empty array is returned

Output
array
Details
visibility
public
final
false
static
false

getUri

getUri( ) : string

Returns a URI based on current values of the instance variables. If any part of the URI does not pass validation, then an exception is thrown.

Output
string
Details
visibility
public
final
false
static
false
throws
When one or more parts of the URI are invalid

getUsername

getUsername( ) : string

Returns the username portion of the URL, or FALSE if none.

Output
string
Details
visibility
public
final
false
static
false

removeQueryParameters

removeQueryParameters( array $queryParamKeys ) : string

Remove params in the query string for the current URI, and return the old query.

Arguments
$queryParamKeys
array
Output
string
Old query string
Details
visibility
public
final
false
static
false

setFragment

setFragment( string $fragment ) : string

Sets the fragment for the current URI, and returns the old fragment

Arguments
$fragment
string
Fragment of the current URI
Output
string
Details
visibility
public
final
false
static
false
throws
When $fragment is not a valid HTTP fragment

setHost

setHost( string $host ) : string

Sets the host for the current URI, and returns the old host

Arguments
$host
string
The HTTP host
Output
string
Details
visibility
public
final
false
static
false
throws
When $host is nota valid HTTP host

setPassword

setPassword( string $password ) : string

Sets the password for the current URI, and returns the old password

Arguments
$password
string
The HTTP password
Output
string
Details
visibility
public
final
false
static
false
throws
When $password is not a valid HTTP password

setPath

setPath( string $path ) : string

Sets the path for the current URI, and returns the old path

Arguments
$path
string
The HTTP path
Output
string
Details
visibility
public
final
false
static
false
throws
When $path is not a valid HTTP path

setPort

setPort( string $port ) : string

Sets the port for the current URI, and returns the old port

Arguments
$port
string
The HTTP port
Output
string
Details
visibility
public
final
false
static
false
throws
When $port is not a valid HTTP port

setQuery

setQuery( string|array $query ) : string

Set the query string for the current URI, and return the old query string This method accepts both strings and arrays.

Arguments
$query
stringarray
The query string or array
Output
string
Old query string
Details
visibility
public
final
false
static
false
throws
When $query is not a valid query string

setUsername

setUsername( string $username ) : string

Sets the username for the current URI, and returns the old username

Arguments
$username
string
The HTTP username
Output
string
Details
visibility
public
final
false
static
false
throws
When $username is not a valid HTTP username

valid

valid( ) : boolean

Validate the current URI from the instance variables. Returns true if and only if all parts pass validation.

Output
boolean
Details
visibility
public
final
false
static
false

validateFragment

validateFragment( string $fragment = null ) : boolean

Returns true if and only if the fragment passes validation. If no fragment is passed, then the fragment contained in the instance variable is used.

Arguments
$fragment
string
Fragment of an URI
Output
boolean
Details
visibility
public
final
false
static
false
link
http://www.faqs.org/rfcs/rfc2396.html
throws
When fragment validation fails

validateHost

validateHost( string $host = null ) : boolean

Returns true if and only if the host string passes validation. If no host is passed, then the host contained in the instance variable is used.

Arguments
$host
string
The HTTP host
Output
boolean
Details
visibility
public
final
false
static
false
uses
Zend_Filter

validatePassword

validatePassword( string $password = null ) : boolean

Returns true if and only if the password passes validation. If no password is passed, then the password contained in the instance variable is used.

Arguments
$password
string
The HTTP password
Output
boolean
Details
visibility
public
final
false
static
false
link
http://www.faqs.org/rfcs/rfc2396.html
throws
When password validation fails

validatePath

validatePath( string $path = null ) : boolean

Returns true if and only if the path string passes validation. If no path is passed, then the path contained in the instance variable is used.

Arguments
$path
string
The HTTP path
Output
boolean
Details
visibility
public
final
false
static
false
throws
When path validation fails

validatePort

validatePort( string $port = null ) : boolean

Returns true if and only if the TCP port string passes validation. If no port is passed, then the port contained in the instance variable is used.

Arguments
$port
string
The HTTP port
Output
boolean
Details
visibility
public
final
false
static
false

validateQuery

validateQuery( string $query = null ) : boolean

Returns true if and only if the query string passes validation. If no query is passed, then the query string contained in the instance variable is used.

Arguments
$query
string
The query to validate
Output
boolean
Details
visibility
public
final
false
static
false
link
http://www.faqs.org/rfcs/rfc2396.html
throws
When query validation fails

validateUsername

validateUsername( string $username = null ) : boolean

Returns true if and only if the username passes validation. If no username is passed, then the username contained in the instance variable is used.

Arguments
$username
string
The HTTP username
Output
boolean
Details
visibility
public
final
false
static
false
link
http://www.faqs.org/rfcs/rfc2396.html
throws
When username validation fails
Documentation was generated by DocBlox.