Class: HTTP2
Source Location: /HTTP2-1.1.1/HTTP2.php
Miscellaneous HTTP Utilities
Author(s):
Version:
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
absoluteURI [line 440]
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:
convertCharset [line 651]
string convertCharset(
string
$from, string
$to, string
$str)
|
|
Convert the given string from one into another charset. Uses mb_convert_encoding or iconv if available.
Parameters:
date [line 55]
string|boolean 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 331]
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:
matchAccept [line 254]
string|NULL matchAccept(
string
$header, array
$supported)
|
|
Parses a weighed "Accept" HTTP header and matches it against a list of supported options
Parameters:
negotiateCharset [line 157]
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 'HTTP2.php';
$charsets = array(
'UTF-8',
'ISO-8859-1',
);
Parameters:
negotiateLanguage [line 101]
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 'HTTP2.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 207]
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 'HTTP2.php';
$contentType = array(
'application/xhtml+xml',
'application/xml',
'text/html',
'text/plain',
);
Parameters:
parseLinks [line 544]
array parseLinks(
string|array
$lines)
|
|
Parses a HTTP "Link" header value as specified by RFC 5988. When errors occur during parsing, all information collected to that point will be returned used and the rest of the line skipped.
Parameters:
redirect [line 390]
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:
sortAccept [line 276]
array sortAccept(
string
$header)
|
|
Parses and sorts a weighed "Accept" HTTP header
Parameters:
Documentation generated on Mon, 11 Mar 2019 15:55:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|