Slip 6 - A) 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

 Solution:

<?php
$url = 'http://www.college.com/Science/Cs.php';
$url=parse_url($url);
echo 'Scheme : '.$url['scheme']."<br>";
echo 'Host : '.$url['host']."<br>";
echo 'Path : '.$url['path']."<br>";
?>

Post a Comment

0 Comments