Friday, 6 May 2022

Advance Php-slip6a- Write a PHP script, which will return the following component of the URL (Using response header) http://www.college.com/Science/CS.php List of Components: scheme, host, path Expected output: Scheme: http Host: www.college.com Path: /Science/CS.php

Write a PHP script, which will return the following component of the URL (Using response header)

http://www.college.com/Science/CS.php List of Components: scheme, host, path Expected output: Scheme: http Host: www.college.com Path: /Science/CS.php

 

<?php

header("Content-type: text/plain");

$url = 'http://www.college.com/Science/CS.php';

 

$url=parse_url($url);

echo 'Scheme : '.$url['scheme']."\n";

echo 'Host : '.$url['host']."\n";

echo 'Path : '.$url['path']."\n";

//var_dump($http_response_header);

?>