0

I am creating an online voting platform. My clients will need an offline version of my website where users come and vote, then the results are collected by entering a passkey into the site and extracting a spreadsheet file (or whatever).

I know how to create the static-code (HTML, CSS, and JS) for the offline webpage in PHP, except for how to put that resulting code into individual files.

How do I write individual files in PHP (not saving on the server), compress them, and then send the compressed package over the network?

Shukant Pal
  • 706
  • 6
  • 19
  • This "offline" instance is set up on a computer that isn't connected to the Internet? – ryantxr May 17 '19 at 03:54
  • To save dynamically generated php output as static html, simply use browser’s “save as” menu option after you load it in the browser. But you seem to have a fundamental misunderstanding of how client server works. Unless you expect your clients to install php and a web server on their local computer, there’s no point in distributing php code. Not to mention that your code would be exposed, so security would be next to impossible. – Tim Morton May 17 '19 at 04:41
  • @TimMorton You didn't get it. The user clicks "download offline version" and then my server runs a script to build a static version of the site. I need to then send a file over the network - not a response to the HTTP request. – Shukant Pal May 19 '19 at 15:47
  • @ryantxr The "offline" instance is created online. After downloading it, it can be run without internet. – Shukant Pal May 19 '19 at 15:49
  • See if this will work for you. https://stackoverflow.com/questions/9046675/convert-a-php-script-into-a-stand-alone-windows-executable – ryantxr May 19 '19 at 16:02
  • If you're using MVC, then have your controller render the output to a file instead of printing to html. If you're doing things procedurally, then use the output buffering https://www.php.net/manual/en/function.ob-start.php to capture the output and save it to file. – Tim Morton May 21 '19 at 20:23

0 Answers0