How catch the URL's parameters of LAN client 's request in Captive Portal custom script?
-
I need to get some URL's parameters (e.g.: id, operation) of LAN client 's request in the Captive Portal custom script and after to build a new request to be run it
-
An example can be found here : /usr/local/captiveportal/index.php
What are you trying to do ?
-
Thanks @Gertjan by feedback
I'm try to get the following client'url
e.g.:
http://<ip/domain>?id=id1&operation=write
I want specifically that string:
"?id=id1&operation=write"
Is it possible?
I've se that file's path that you showed, but i didn't get reuse any snippet code. Only IP and MAC.
-
Hi, everyone!
I've realized the request with the following URL :
siga.ufpe.br/device?id=iotflows1&peration=write&value=onBut, only one parameter was catched. The first one.
I've put the code in the captive portal custom script:
echo nl2br("========================\n"); echo nl2br("SERVER REQUEST URI = " . $_SERVER['REQUEST_URI'] . "\n"); parse_str( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY), $array ); echo nl2br("SERVER PARSE ARRAY = \n" ); var_dump($array); echo nl2br("\n========================\n"); /*echo "SERVER REQUEST DUMP = " . var_dump($_SERVER); echo "\n";*/ $orig_request = $_REQUEST['redirurl']; echo nl2br("CLIENT REQUEST REDIRURL = " . $orig_request . "\n"); parse_str( parse_url( $orig_request, PHP_URL_QUERY), $array ); echo nl2br("SERVER PARSE ARRAY = \n" ) ; var_dump($array); echo nl2br("\n========================\n"); print_r($_REQUEST);
======================== SERVER REQUEST URI = /index.php?zone=iotflows&redirurl=http%3A%2F%2Fsiga.ufpe.br%2Fdevice%3Fid%3Diotflows1 SERVER PARSE ARRAY = array(2) { ["zone"]=> string(8) "iotflows" ["redirurl"]=> string(39) "http://siga.ufpe.br/device?id=iotflows1" } ======================== CLIENT REQUEST REDIRURL = http://siga.ufpe.br/device?id=iotflows1 SERVER PARSE ARRAY = array(1) { ["id"]=> string(9) "iotflows1" } ======================== Array ( [zone] => iotflows [redirurl] => http://siga.ufpe.br/device?id=iotflows1 )
Are there some tips to get all parameters?
-
@rbsa said in How catch the URL's parameters of LAN client 's request in Captive Portal custom script?:
echo nl2br("SERVER PARSE ARRAY" . $array . "\n"
Is this $array an array ?
If so, then note that you can't print arrays like that.edit : your edit shows the result : the word "array" shows up, not the content of the $array.
You're aware of the fact that your using basic PHP ?
This means that you have the answer of any question at your fingertips. Like "Google ! Going ? well ? Great ! me too, please tell me, how do I print the content of an array using PHP" ?
Answer : use print_r().
Other possibilities exist. -
@gertjan said in How catch the URL's parameters of LAN client 's request in Captive Portal custom script?:
you have the answer of any question at your finge
It was mistakes
So, I update now.
Check out
I need only sugestions about the parameters problem . -
What about checking what in $_REQUEST ?
Try for yourself :
print_r($_REQUEST);
-
The same thing. Could you simulate that?