URL
Table of Contents
Functions
- build_query() : mixed
- Generate URL-encoded query string according to RFC 3986
- escape() : mixed
- Escape a component of a URL according to RFC 3986
- reduceUrl() : string
- reduce the size of long URL to keep web browser display tidy
- getCurrentProtocol() : string
- Return the protocol requested by the HTTP client
- getVhost() : string
- Return the vHost name (Virtual Hostname)
- URL_exists() : bool
- Check that an internet resource exists
Functions
build_query()
Generate URL-encoded query string according to RFC 3986
build_query(mixed $data) : mixed
This function is a wrapper for http_build_query() where $encoding_type parameter is always PHP_QUERY_RFC3986
Parameters
- $data : mixed
-
Array or object
escape()
Escape a component of a URL according to RFC 3986
escape(mixed $url) : mixed
This function attempts to split a URL into its components and recompose it after decoding and re-encoding the components.
A well-constructed URL should not suffer from this operation. Those that are malformed can be corrected but if an & character appears in the parameters, parameters may disappear.
Use the \URL\build_query() function to construct well-encoded parameters.
Parameters
- $url : mixed
Tags
reduceUrl()
reduce the size of long URL to keep web browser display tidy
reduceUrl(string $text[, false|int $limit = FALSE ]) : string
Parameters
- $text : string
- $limit : false|int = FALSE
-
Default is FALSE
Return values
stringgetCurrentProtocol()
Return the protocol requested by the HTTP client
getCurrentProtocol() : string
Return values
string —http or https
getVhost()
Return the vHost name (Virtual Hostname)
getVhost() : string
Read also the special 'CLI_VHOST' constant which can be defined to simulate a vHost in CLI mode.
Return an empty string when the vHost cannot be read.
Return values
stringURL_exists()
Check that an internet resource exists
URL_exists(string $url) : bool
Parameters
- $url : string