Approach:
Parse the URL string using parse_url() function which will return an associative array that contains its (passed URL) various components. The query of the array returned by parse_url() function which contains a query string of URL.
Below examples uses parse_url() and parse_str() function to get the parameters from URL string.
Syntax:
parse_str( $string, $array )
<?php
// Inintialize URL to the variable
$url = 'http://www.bajarangi.org?name=Tonny';
// Use parse_url() function to parse the URL
// and return an associative array which
// contains its various components
$url_components = parse_url($url);
// Use parse_str() function to parse the
// string passed via URL
parse_str($url_components['query'], $params);
// Display result
echo ' Hi '.$params['name'];
?>
parse_url( $url, $component = -1 )
<?php
// Inintialize URL to the variable
$url = 'http://www.bajarangi.org?name=siri&email=siri@756@gmail.com';
// Use parse_url() function to parse the URL
// and return an associative array which
// contains its various components
$url_components = parse_url($url);
// Use parse_str() function to parse the
// string passed via URL
parse_str($url_components['query'], $params);
// Display result
echo ' Hi '.$params['name'].' your emailID is '.$params['email'];
?>