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

    More PFSESNE collect the DCHP table

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 1 Posters 2.8k 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.
    • X
      X.Z.
      last edited by

      I have six PFSENSE I hope to integrate the DHCP form
      May I ask how you want to use a CURL login PFSESEN to the DCHP page?
      Thank you

      1 Reply Last reply Reply Quote 0
      • X
        X.Z.
        last edited by

        I tried using the following code to try to login
        But they are unable to successfully
        May I ask which side is wrong yet?

        
        // http://000.000.000.000
        // usernamefld   admin
        // passwordfld   #00000@0#
        
        $form_vars = array();
        
        $username = 'admin';
        $password = ' #00000@0#';
        $loginUrl = 'http://000.000.000.000/index.php';
        $postUrl='http://000.000.000.000';
        $user_agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $loginUrl);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'usernamefld'.$username.'passwordfld'.$password);
        curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
        
        $store = curl_exec($ch);
        echo $store
        ?>
        
        

        error.PNG
        error.PNG_thumb

        1 Reply Last reply Reply Quote 0
        • X
          X.Z.
          last edited by

          I tried using the LYNC login CENTOS
          A need to agree to two COOKIE start
          May ask the problem is here to assist you modify the code
          Thank you!!

          
          172.30.34.254 cookie:PHPSESSID=c5fd9a26bfd47842da6274f0087e0169 是否接受? (Y/N/Always/neVer)
          172.30.34.254 cookie:cookie_test=1381989432 是否接受? (Y/N/Always/neVer)
          Username:
          ____________________
          
          Password:
          ____________________
          
          Enter username and password to login.
          
          Login
          
          transparent
          webConfigurator
          pfsense
          * System
          + Advanced
          + Cert Manager
          + Firmware
          + General Setup
          + High Avail. Sync
          + Logout
          + Packages
          + Routing
          + Setup Wizard
          + User Manager
          * Interfaces
          
          
          1 Reply Last reply Reply Quote 0
          • X
            X.Z.
            last edited by

            i try edit code like this
            still ERROR  :(

            
            // http://000.000.000.000
            // usernamefld   admin
            // passwordfld   #00000@0#
            
            $form_vars = array();
            
            $username = 'admin';
            $password = '#00000@0#';
            $loginUrl = 'http://172.30.34.254/index.php';
            $postUrl='http://172.30.34.254/index.php';
            $user_agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
            $form_data= 'login=Login&usernamefld=admin&passwordfld=#00000@0#';
            
            $ckfile = "/tmp/Cookiefile.txt";
            
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $loginUrl);
            curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
            //curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
            // curl_setopt($ch, CURLOPT_COOKIE, "A=01;B=02;C=03");
            curl_setopt($ch, CURLOPT_POST, TRUE);
            curl_setopt($ch, CURLOPT_POSTFIELDS, 'login=Login&usernamefld=admin&passwordfld=#00000@0#');
            //curl_setopt($ch, CURLOPT_POSTFIELDS, $form_data);
            //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
            //curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
            //curl_setopt($ch, CURLOPT_REFERER, $postUrl); 
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            curl_exec($ch);
            
            curl_setopt($ch, CURLOPT_URL, $postUrl);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
            $store = curl_exec($ch);
            //curl_exec($ch);
            echo $store;
            
            curl_close($ch);
            ?>
            
            
            
            CSRF check failed. Either your session has expired, this page has been inactive too long, or you need to enable cookies.
            Debug: 
            
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.