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

    Captive Portal Upload

    Scheduled Pinned Locked Moved Captive Portal
    6 Posts 2 Posters 2.1k 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.
    • S
      SmartCodar
      last edited by

      Hi,

      Is there any by by which I can upload the Captive Portal File using PHP or any Script instead of PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents.

      PFSense build that I am using is 2.2.4

      Sincere Thanks,

      Ameet Parse

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

        @SmartCodar:

        Is there any by by which I can upload the Captive Portal File using PHP or any Script instead of PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents.

        This "PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents"
        IS a PHP page that let you upload the page and does all the work needed to insert it in the system.
        What about reusing it to make yours ?

        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
        • S
          SmartCodar
          last edited by

          @Gertjan:

          @SmartCodar:

          Is there any by by which I can upload the Captive Portal File using PHP or any Script instead of PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents.

          This "PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents"
          IS a PHP page that let you upload the page and does all the work needed to insert it in the system.
          What about reusing it to make yours ?

          Thanks for quick reply,

          Basically I need to Upload the Captive Portal Page pro-grammatically. For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

          Thanks,

          Ameet Parse

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

            @SmartCodar:

            Basically I need to Upload the Captive Portal Page pro-grammatically.

            …..
            For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

            From how I understand it, when pfSense reboots, using PHP a script, use wget/ftp/curl/what-ever to 'import' a new html file, and write_config() it.
            See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_captiveportal.php#L447

            The other way around: create a script (it can be on any device that can access pfSense**)  that accepts a $POST, so you can send ove new file - put it in the config,  write_config() and restart the captive portal service.

            ** if needed, you can decide to skip the entire GUI login protection. Remember, its PHP, your free to do what you want ;)

            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
            • S
              SmartCodar
              last edited by

              @Gertjan:

              Thanks,

              Can you please let me know which config file I need to use? Also does Write_Config can be called using a Cron? I mean without doing login or Authentication.
              @SmartCodar:

              Basically I need to Upload the Captive Portal Page pro-grammatically.

              …..
              For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

              From how I understand it, when pfSense reboots, using PHP a script, use wget/ftp/curl/what-ever to 'import' a new html file, and write_config() it.
              See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_captiveportal.php#L447

              The other way around: create a script (it can be on any device that can access pfSense**)  that accepts a $POST, so you can send ove new file - put it in the config,  write_config() and restart the captive portal service.

              ** if needed, you can decide to skip the entire GUI login protection. Remember, its PHP, your free to do what you want ;)

              1 Reply Last reply Reply Quote 0
              • S
                SmartCodar
                last edited by

                @SmartCodar:

                @Gertjan:

                Thanks Gertjan this worked very well
                Thanks,

                Can you please let me know which config file I need to use? Also does Write_Config can be called using a Cron? I mean without doing login or Authentication.
                @SmartCodar:

                Basically I need to Upload the Captive Portal Page pro-grammatically.

                …..
                For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

                From how I understand it, when pfSense reboots, using PHP a script, use wget/ftp/curl/what-ever to 'import' a new html file, and write_config() it.
                See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_captiveportal.php#L447

                The other way around: create a script (it can be on any device that can access pfSense**)  that accepts a $POST, so you can send ove new file - put it in the config,  write_config() and restart the captive portal service.

                ** if needed, you can decide to skip the entire GUI login protection. Remember, its PHP, your free to do what you want ;)

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