Slip no. 3. Write a PHP script, which will return the
following component of the URL
List of component: Scheme, Host, Path
Excepted o/p
Scheme: http
Host: www.example.com
Path:/php-example/index.php
<?php
$url =
'http://www.example.com/php-example/index.php';
print_r(parse_url($url));
$scheme
= parse_url($url,PHP_URL_SCHEME);
echo
"<br><br>Scheme : $scheme";
$host =
parse_url($url,PHP_URL_HOST);
echo
"<br><br>Host : $host";
$path =
parse_url($url,PHP_URL_PATH);
echo
"<br><br>path : $path";
?>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.