parse_url
array parse_url(string URL)
Breaks a URL into its various components.
Returns:
Array containing the various components of the URL; NULL if the given URL is invalid or if an error is encountered
Description:
parse_url() returns an associative array that contains the various components of the given URL. This function can recognize the following components:
Component | Description |
---|---|
scheme | The protocol being used. Common schemes are FTP, HTTP, Telnet, and so on. |
host | The domain name of a network host, or an IPv4 address as a set of four decimal digit groups separated by literal periods; for example, www.php.net or babelfish.altavista.com. |
port | The port being accessed. In the URL http://www.some_host.com:443/, 443 is the port component. ... |
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.