![]() |
|
|
+ Search |
![]()
|
May 29th, 2002 08:17
Philip Olson, Kevin Nonya, reenu goerge,
URL literally stands for: Uniform Resource Locator A generic URL is: http://www.example.com/dir/foo.php?fruit=apple&color=red Let's use parse_url() to divide it up: $url = 'http://www.example.com/dir/foo.php?fruit=apple&color=red'; $url_parts = parse_url($url); print_r($url); Which results in: [scheme] => http [host] => www.example.com [path] => /dir/foo.php [query] => fruit=apple&color=red The meaning behind all this can be read about here: http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?URL PHP makes this information available in many ways, typically through various predefined variables. For example: print $_SERVER['QUERY_STRING']; // fruit=apple&color=red print $_GET['fruit']; // apple print basename($_SERVER['PHP_SELF']); // foo.php