How do I parse a URL in PHP? -
possible duplicate:
parsing domain url in php
how
http://localhost/ from
http://localhost/something/ using php
i tried
$base = strtok($url, '/');
you can use parse_url down hostname.
e.g.:
$url = "http://localhost/path/to/?here=there"; $data = parse_url($url); var_dump($data); /* array ( [scheme] => http [host] => localhost [path] => /path/to/ [query] => here=there ) */
Comments
Post a Comment