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
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
You can iterate over the $_GET array:
<?php
foreach ($_GET as $paramKey => $paramValue) {
//...
}
$query = array();
parse_str($_SERVER['QUERY_STRING'], $query);
// $query['a'] = 1, ...
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);
?>
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'