tags:

views:

62

answers:

4

If I have a URL like this:

http://www.example.com/?a=1&b=2&c=3 (an example)

I am working on a project and want to see what parameters are passing to a URL internally.

thanks

+4  A: 

You can iterate over the $_GET array:

<?php
foreach ($_GET as $paramKey => $paramValue) {
    //...
}
CMS
thank you ........................
iaddesign
A: 
$query = array();
parse_str($_SERVER['QUERY_STRING'], $query);

// $query['a'] = 1, ...
Zed
A: 

If you only want to see what is being passed and how PHP is handling your GET values, the simplest method would be:

<?
var_dump($_GET);
?>
Lachlan McDonald
A: 

There are several sources for that:

  • $_GET is an array of the already parsed query string. In your case:

    array('a'=>'1', 'b'=>'2', 'c'=>'3')
    
  • $_SERVER['QUERY_STRING'] is the raw query string. In your case:

    'a=1&b=2&c=3'
    
  • $_SERVER['REQUEST_URI'] contains the requested URL path plus the query. In your case:

    '/?a=1&b=2&c=3'
    
Gumbo