Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How catch the URL's parameters of LAN client 's request in Captive Portal custom script?

    Scheduled Pinned Locked Moved Captive Portal
    8 Posts 2 Posters 925 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rbsa
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan
        last edited by

        An example can be found here : /usr/local/captiveportal/index.php

        What are you trying to do ?

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        1 Reply Last reply Reply Quote 0
        • R
          rbsa
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • R
            rbsa
            last edited by rbsa

            Hi, everyone!

            I've realized the request with the following URL :
            siga.ufpe.br/device?id=iotflows1&peration=write&value=on

            But, 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?

            GertjanG 1 Reply Last reply Reply Quote 0
            • GertjanG
              Gertjan @rbsa
              last edited by Gertjan

              @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.

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

              1 Reply Last reply Reply Quote 1
              • R
                rbsa
                last edited by rbsa

                @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 .

                1 Reply Last reply Reply Quote 0
                • GertjanG
                  Gertjan
                  last edited by

                  What about checking what in $_REQUEST ?

                  Try for yourself :

                  print_r($_REQUEST);
                  

                  No "help me" PM's please. Use the forum, the community will thank you.
                  Edit : and where are the logs ??

                  R 1 Reply Last reply Reply Quote 0
                  • R
                    rbsa @Gertjan
                    last edited by

                    @gertjan

                    The same thing. Could you simulate that?

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.