The task:
Create a list that stores the parsing of the URL according to its properties: protocol, port, host, path, resource, query words and print as “Name / Value”
I use the parse_url
function, but I don’t understand a bit, I recently opened PHP. Can anyone explain to me about parsing the URL: what is "protocol, port, host, path, resource, query words"? The protocol, it seems, is http, the host is understandable, I get lost about the rest. They can be parse_url
using parse_url
and what should be the address? If possible, explain with examples.
At the given URL
http://www.scriptol.com/how-to/parsing-url.php#content
It gives me only
Array ([scheme] => http [host] => www.scriptol.com [path] => /how-to/parsing-url.php [fragment] => content)
PHP code:
$url = "http://www.scriptol.com/how-to/parsing-url.php#content"; $arr = parse_url($url); print_r($arr);