TY_BCS_PHP_SLIP 3_1



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
Path:/php-example/index.php
PHP file :
<?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.