A useful function in PHP, parse_url, is particularly convenient for information capture analysis. For example: 
$ Url = "http://www.electrictoolbox.com/php-extract-domain-from-full-url "; 
$ Parts = parse_url ($ URL ); 
Output: 
Array 
( 
[Scheme] => HTTP 
[Host] => www.electrictoolbox.com 
[Path] =>/PHP-extract-Domain-from-full-URL/ 
) 
 
 
 
 
Another example:<? PHP
$ URL='Http: // username: password @ Hostname/path? Arg = value # anchor';
 
 
Print_r(Parse_url($ URL));
 
 
 
EchoParse_url($ URL,Php_url_path);
?> 
 
 
 output: 
 array 
 (
 [Scheme] => HTTP 
 [host] => hostname 
 [user] => username 
 [pass] => password 
 [path] =>/path 
 [query] => Arg = value 
 [fragment] => anchor 
) 
 as you can see, each part of a URL can be easily decomposed. It is also easy to obtain the specified part, for example, 
 echo  parse_url   (  $ URL  ,   php_url_path   ); 
 In the second parameter, set the following parameters: 
 php_url_scheme, php_url_host, php_url_port, php_url_user, php_url_pass, php_url_path, php_url_query or php_url_fragment.