Class: HTTP
Source Location: /HTTP-1.4.1/HTTP.php
Miscellaneous HTTP Utilities
Author(s):
Version:
- Release: $Revision: 1.56 $
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
absoluteURI [line 446]
string absoluteURI(
[string
$url = null], [string
$protocol = null], [integer
$port = null])
|
|
This function returns the absolute URI for the partial URL passed. The current scheme (HTTP/HTTPS), host server, port, current script location are used if necessary to resolve any relative URLs. Offsets potentially created by PATH_INFO are taken care of to resolve relative URLs to the current script. You can choose a new protocol while resolving the URI. This is particularly useful when redirecting a web browser using relative URIs and to switch from HTTP to HTTPS, or vice-versa, at the same time.
Parameters:
Date [line 57]
mixed Date(
[mixed
$time = null])
|
|
Formats a RFC compliant GMT date HTTP header. This function honors the "y2k_compliance" php.ini directive and formats the GMT date corresponding to either RFC850 or RFC822.
Parameters:
head [line 336]
array head(
string
$url, [integer
$timeout = 10])
|
|
Sends a "HEAD" HTTP command to a server and returns the headers as an associative array. Example output could be: Array
(
[response_code] => 200 // The HTTP response code
[response ] => HTTP/1.1 200 OK // The full HTTP response string
[Date] => Fri , 11 Jan 2002 01:41:44 GMT
[Server] => Apache/1.3.20 (Unix) PHP/4.1.1
[X-Powered-By] => PHP/4.1.1
[Connection] => close
[Content-Type] => text/html
)
Parameters:
negotiateCharset [line 160]
string negotiateCharset(
array
$supported, [string
$default = 'ISO-8859-1'])
|
|
Negotiates charset with the user's browser through the Accept-Charset HTTP header. Quality factors in the Accept-Charset: header are supported, e.g.: Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8 require_once 'HTTP.php';
$charsets = array(
'UTF-8',
'ISO-8859-1',
);
Parameters:
negotiateLanguage [line 104]
string negotiateLanguage(
array
$supported, [string
$default = 'en-US'])
|
|
Negotiates language with the user's browser through the Accept-Language HTTP header or the user's host address. Language codes are generally in the form "ll" for a language spoken in only one country, or "ll-CC" for a language spoken in a particular country. For example, U.S. English is "en-US", while British English is "en-UK". Portugese as spoken in Portugal is "pt-PT", while Brazilian Portugese is "pt-BR". Quality factors in the Accept-Language: header are supported, e.g.: Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8 require_once 'HTTP.php';
$langs = array(
'en' => 'locales/en',
'en-US' => 'locales/en',
'en-UK' => 'locales/en',
'de' => 'locales/de',
'de-DE' => 'locales/de',
'de-AT' => 'locales/de',
);
$dir = $langs[$neg];
Parameters:
negotiateMimeType [line 209]
string negotiateMimeType(
array
$supported, string
$default)
|
|
Negotiates content type with the user's browser through the Accept HTTP header. Quality factors in the Accept: header are supported, e.g.: Accept: application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8 require_once 'HTTP.php';
$contentType = array(
'application/xhtml+xml',
'application/xml',
'text/html',
'text/plain',
);
$mime = HTTP::negotiateContentType ($contentType);
Parameters:
raiseError [line 541]
object PEAR_Error raiseError(
[mixed
$error = null], [integer
$code = null])
|
|
Raise Error Lazy raising of PEAR_Errors.
Parameters:
redirect [line 395]
boolean redirect(
string
$url, [bool
$exit = true], [bool
$rfc2616 = false])
|
|
This function redirects the client. This is done by issuing a "Location" header and exiting if wanted. If you set $rfc2616 to true HTTP will output a hypertext note with the location of the redirect.
Parameters:
Documentation generated on Mon, 11 Mar 2019 15:25:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|