API Documentation

Uri/Http.php

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.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Uri  
version
$Id: Http.php 23970 2011-05-03 15:46:57Z ralph $  

\Zend_Uri_Http

HTTP(S) URI handler

Extends from
\Zend_Uri
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Uri  
uses
\Zend_Uri  

Constants

Constant  CHAR_ALNUM = 'A-Za-z0-9'

Character classes for validation regular expressions

Constant  CHAR_MARK = '-_.!~*\'()\[\]'
Constant  CHAR_RESERVED = ';\/?:@&=+$,'
Constant  CHAR_SEGMENT = ':@&=+$,;'
Constant  CHAR_UNWISE = '{}|\\\\^`'

Properties

Propertyprotectedstring  $_fragment= ''

HTTP fragment

Details
Type
string
Propertyprotectedstring  $_host= ''

HTTP host

Details
Type
string
Propertyprotectedstring  $_password= ''

HTTP password

Details
Type
string
Propertyprotectedstring  $_path= ''

HTTP part

Details
Type
string
Propertyprotectedstring  $_port= ''

HTTP post

Details
Type
string
Propertyprotectedstring  $_query= ''

HTTP query

Details
Type
string
Propertyprotectedarray  $_regex= 'array'

Regular expression grammar rules for validation; values added by constructor

Default valuearrayDetails
Type
array
Propertyprotectedstring  $_username= ''

HTTP username

Details
Type
string

Methods

methodprotected__construct( string $scheme, string $schemeSpecific ) : void

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)

Use Zend_Uri::factory() to return a new Zend_Uri object.

Parameters
Name Type Description
$scheme string The scheme of the URI
$schemeSpecific string

The scheme-specific part of the URI

Throws
Exception Description
\Zend_Uri_Exception When the URI is not valid
methodpublic__toString( ) : string

Return a string representation of this URI.

Inherited from: \Zend_Uri::__toString()
Returns
Type Description
string
Details
see
\getUri()  
methodprotected_parseUri( string $schemeSpecific ) : void

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

Parameters
Name Type Description
$schemeSpecific string

The scheme-specific portion to parse

Throws
Exception Description
\Zend_Uri_Exception When scheme-specific decoposition fails
\Zend_Uri_Exception When authority decomposition fails
methodpublicaddReplaceQueryParameters( array $queryParams ) : string

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

Parameters
Name Type Description
$queryParams array
Returns
Type Description
string Old query string
methodpubliccheck( string $uri ) : boolean
static

Convenience function, checks that a $uri string is well-formed by validating it but not returning an object. Returns TRUE if $uri is a well-formed URI, or FALSE otherwise.

Inherited from: \Zend_Uri::check()
Parameters
Name Type Description
$uri string The URI to check
Returns
Type Description
boolean
methodpublicfactory( string $uri = http, string $className = null ) : \Zend_Uri
static

Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.

Inherited from: \Zend_Uri::factory()
Parameters
Name Type Description
$uri string The URI form which a Zend_Uri instance is created
$className string The name of the class to use in order to manipulate URI
Returns
Type Description
\Zend_Uri
Throws
Exception Description
\Zend_Uri_Exception When an empty string was supplied for the scheme
\Zend_Uri_Exception When an illegal scheme is supplied
\Zend_Uri_Exception When the scheme is not supported
\Zend_Uri_Exception When $className doesn't exist or doesn't implements Zend_Uri
Details
link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicfromString( string $uri ) : \Zend_Uri_Http
static

Creates a Zend_Uri_Http from the given string

Parameters
Name Type Description
$uri string

String to create URI from, must start with 'http://' or 'https://'

Returns
Type Description
\Zend_Uri_Http
Throws
Exception Description
\InvalidArgumentException When the given $uri is not a string or does not start with http:// or https://
\Zend_Uri_Exception When the given $uri is invalid
methodpublicgetFragment( ) : string|false

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

Returns
Type Description
stringfalse
methodpublicgetHost( ) : string

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

Returns
Type Description
string
methodpublicgetPassword( ) : string

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

Returns
Type Description
string
methodpublicgetPath( ) : string

Returns the path and filename portion of the URL.

Returns
Type Description
string
methodpublicgetPort( ) : string

Returns the TCP port, or FALSE if none.

Returns
Type Description
string
methodpublicgetQuery( ) : string

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

Returns
Type Description
string
methodpublicgetQueryAsArray( ) : array

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

Returns
Type Description
array
methodpublicgetScheme( ) : string|false

Get the URI's scheme

Inherited from: \Zend_Uri::getScheme()
Returns
Type Description
stringfalse Scheme or false if no scheme is set.
methodpublicgetUri( ) : 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.

Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When one or more parts of the URI are invalid
methodpublicgetUsername( ) : string

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

Returns
Type Description
string
methodpublicremoveQueryParameters( array $queryParamKeys ) : string

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

Parameters
Name Type Description
$queryParamKeys array
Returns
Type Description
string Old query string
methodpublicsetConfig( \Zend_Config|array $config ) : void
static

Set global configuration options

Inherited from: \Zend_Uri::setConfig()
Parameters
Name Type Description
$config \Zend_Config|array
methodpublicsetFragment( string $fragment ) : string

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

Parameters
Name Type Description
$fragment string Fragment of the current URI
Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When $fragment is not a valid HTTP fragment
methodpublicsetHost( string $host ) : string

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

Parameters
Name Type Description
$host string The HTTP host
Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When $host is nota valid HTTP host
methodpublicsetPassword( string $password ) : string

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

Parameters
Name Type Description
$password string The HTTP password
Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When $password is not a valid HTTP password
methodpublicsetPath( string $path ) : string

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

Parameters
Name Type Description
$path string The HTTP path
Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When $path is not a valid HTTP path
methodpublicsetPort( string $port ) : string

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

Parameters
Name Type Description
$port string The HTTP port
Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When $port is not a valid HTTP port
methodpublicsetQuery( 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.

Parameters
Name Type Description
$query string|array The query string or array
Returns
Type Description
string Old query string
Throws
Exception Description
\Zend_Uri_Exception When $query is not a valid query string
methodpublicsetUsername( string $username ) : string

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

Parameters
Name Type Description
$username string The HTTP username
Returns
Type Description
string
Throws
Exception Description
\Zend_Uri_Exception When $username is not a valid HTTP username
methodpublicvalid( ) : boolean

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

Returns
Type Description
boolean
methodpublicvalidateFragment( 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.

Parameters
Name Type Description
$fragment string Fragment of an URI
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Uri_Exception When fragment validation fails
Details
link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicvalidateHost( 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.

Parameters
Name Type Description
$host string The HTTP host
Returns
Type Description
boolean
Details
uses
\Zend_Filter  
methodpublicvalidatePassword( 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.

Parameters
Name Type Description
$password string The HTTP password
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Uri_Exception When password validation fails
Details
link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicvalidatePath( 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.

Parameters
Name Type Description
$path string The HTTP path
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Uri_Exception When path validation fails
methodpublicvalidatePort( 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.

Parameters
Name Type Description
$port string The HTTP port
Returns
Type Description
boolean
methodpublicvalidateQuery( 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.

Parameters
Name Type Description
$query string The query to validate
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Uri_Exception When query validation fails
Details
link
http://www.faqs.org/rfcs/rfc2396.html  
methodpublicvalidateUsername( 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.

Parameters
Name Type Description
$username string The HTTP username
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Uri_Exception When username validation fails
Details
link
http://www.faqs.org/rfcs/rfc2396.html  
Documentation was generated by DocBlox 0.13.3.