API Documentation

Zend/Uri/Http.php

Show: inherited
Table of Contents

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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Uri  
Version
$Id: Http.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Uri_Http

Package: Zend\Uri

HTTP(S) URI handler

Parent(s)
\Zend_Uri
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
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

Default value''Details
Type
string
Propertyprotectedstring  $_host= ''''

HTTP host

Default value''Details
Type
string
Propertyprotectedstring  $_password= ''''

HTTP password

Default value''Details
Type
string
Propertyprotectedstring  $_path= ''''

HTTP part

Default value''Details
Type
string
Propertyprotectedstring  $_port= ''''

HTTP post

Default value''Details
Type
string
Propertyprotectedstring  $_query= ''''

HTTP query

Default value''Details
Type
string
Propertyprotectedarray  $_regex= 'array()'

Regular expression grammar rules for validation; values added by constructor

Default valuearray()Details
Type
array
Propertyprotectedstring  $_username= ''''

HTTP username

Default value''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)

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
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
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
string|false
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
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
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.15.1.