A decision is needed due to which data was received via url / GET / POST, Vordovsky or another text file was generated (according to a predetermined pattern, where the transmitted data would be substituted) and sent to the client, that is, the file was downloaded to the computer. Tell me, are there any similar services or ready-made solutions (in php, java)?

1 answer 1

You can do all this in php

$Word = $this->load->view('/view_word_shablon', $this->data, true); $Word = "\xEF\xBB\xBF" . $Word; // UTF-8 BOM $filename = 'export-word-' . $id . '.doc'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/msword"); header("Content-Disposition: attachment; filename=" . $filename . ";"); header("Content-Length: " . $filename); $this->load->helper('download'); force_download($filename, $Word); 

This is a working code, made on CodeIgniter. The template contains a simple php file with several echo and print , etc.

It may help.

  • but could not help explain where I insert the template vordovskogo doc. Here, for example, I want to send POST data by request to php. And then php takes the data, inserts it into a pre-prepared template .doc (or .rtf) and returns it to the client for download - illusion
  • @illusion What framework do you use? or pure php do everything? - Saidolim
  • pure php, the actual database is made on the Zoho constructor, data can be sent from the database, for example POSTóm, and the ready .rtf .doc is already returned to the client where the data was substituted into the template - illusion