简体   繁体   中英

Send a xml file from python script to php script for downloading

I am in a project to convert a text file to xml using PHP and python. I am using ubuntu and apache2 server.

I have so far acheived to:

  1. Write PHP code that can select any text file from my local system after connecting to localhost.

  2. Pass on the selected file from PHP to python script to convert it into xml.

  3. After conversion of the text file the contents of the xml is getting stored in a newly created xml file in my local computer from where I fetched the text file (from /var/www/html/.....).

My doubt is to:

  1. How can I send the xml file created by the python file to PHP script again.

  2. How I can download the xml file from the PHP script into my local computer.

Any suggestions regarding this is most appreciated. Thanks for help in advance.

  1. I suppose you are using some kind of subprocess to invoke Python from PHP. That way you could listen to the Python's stdout. In Python script you just print out the absolute path to the XML file after the conversion is done.

  2. Just write PHP code that returns an attachment. Eg How to return a file in PHP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM