I have an url that I call in this form :
http://MyIP/MyServer/php_scripts/test_sp.php?param1=key¶m2=xyz5
and I would like to retrieve the value of the 'param1' and 'param2' parameters. Up to now, I was not successful, because all I get is an empty value.
Sure that I am certainly doing something wrong there, but is it with the way I am calling the url or in my php code itself? Any help will be highly appreciated. Thanks a lot for reading me.
The code below is the contents of my 'test_sp.php' file :
<html>
<head>
</head>
<body>
<?php
mainProcess();
function mainProcess()
{
$mavalue1 = "";
$mavalue2 = "";
$parts = parse_url($url, PHP_URL_QUERY); // << It looks like I also have a problem with this line.
parse_str($query, $params);
$mavalue1 = $_GET['param1'];
$mavalue2 = $_GET['param2'];
echo "Valeur de mavalue1 : " . $mavalue1; // <<< This is where I'm getting the empty value
echo "Valeur de mavalue2 : " . $mavalue2; // <<< Same problem here
}
?>
</body>
</html>