Retrieving URL Query Part

<?php

function urlQUERY($url)
{

$url_data = parse_url ($url);
if (!$url_data) return FALSE;

$path =”;
$query =”;
if  (isset( $url_data[‘path’])) $path .=  $url_data[‘path’];
if  (isset( $url_data[‘query’])) $query .=  ‘?’ .$url_data[‘query’];

echo “$path
$query
“;
}

$url=”Enter Your URL”;

urlQUERY($url));

?>

Leave a Comment