[php]
// Function to parse a url and extract its arguments.
function process_url( $url )
{
$processed_url = parse_url( $url );

$query_string = $processed_url[ ‘query’ ];

# split into arguments and values
$query_string = explode( ‘&’, $query_string );

$args = array( ); // return array

foreach( $query_string as $chunk )
{
$chunk = explode( ‘=’, $chunk );
// it’s only really worth keeping if the parameter
// has an argument.
if ( count( $chunk ) == 2 )
{
list( $key, $val ) = $chunk;
$args[ $key ] = urldecode( $val );
}
}

return $args;
}

$url = ‘http://www.google.co.nz/search?q=simon+rocks!&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official’;

$result = process_url( $url );

print_r( $result );

[/php]

Will result in something like this:

[php]
Array
(
[q] => simon rocks!
[start] => 0
[ie] => utf-8
[oe] => utf-8
[client] => firefox-a
[rls] => org.mozilla:en-US:official
)
[/php]