working with php and python together - php

currently i am working on a project which is related to automation.
I am using php and mysql for my work. I have to make a code in php which can import, export and edit the excel file and the extension of excel file is .xlsm. As i have tried my best, but i didn't succeed with the .xlsm file.
so, one of my friend has suggest me that in python, you can do that.
so, is it possible, if i insert the python script(which can import, export and edit the .xlsm file) into the php code and the run the code. please let me know, will this work. if this work then how?

You can use exec() to execute an external program in PHP.

Related

php export excel file

I am woking on exporting datas to excel file from mysql.I google some docs and finally I choose the PHPExcel,it works well and I can successfully complete my work.
but when I upload my code to the online server,it display an error which is "XMLWriter is not found",I also google for this and I know it because the installed php isn't compiled with the class "XMLWriter ",but the question is I have no privilege to recompile the php source.
so if there is other open source class that is used to export data to excel file?
I hope I describe my question clearly.
If you can avoid using PHPExcel, have a look at this tutorial for a plain and simple solution, it might help.
Since you have no control on your PHP installation, I strongly suggest you to abandon PHPExcel, as your PHP version does not include the needed libraries for this package and you don't want to go though painful hacks to make it work somehow...

Run VBScript on server from javascript/php

I have a Single Page Application written in JavaScript and PHP, I am trying to run an external .vbs file on my server?
I have tried using the php COM class as well as exec() to no avail. Has anyone successfully achieved this? Is it even possible?
Found this gem: http://technet.microsoft.com/en-us/library/ee156587.aspx
By that, you should try the similar in PHP:
exec('wscript "C:/path/to/script.vbs"');

Exporting and Importing .csv files using a script

Hi I have a MAMP server set up on a mac I am using and I have this displaying a calendar using the php icalendar source code. I am trying to have this display a public calendar which I can do but I need it to be up to date so I need it to import the Calendars csv file regularly. So my question is does anyone know how I could go about programmatically exporting a .csv file from a public calendar and how I could then import it into a certain location on a server again via a script or code?
Thanks a lot
There are a lot of ways to download the .csv file.
You could use fopen, cURL to download the file. For fopen you need to enable to read files from an url.
An other way, must be supported by the other party. Is to use ftp.
I think the best way for these is just look at php.net how to let them work.
Second you want to make a scheduld job. I don't know it in macs, but with linux you can make cron's you can say these need to be run every x time (1min, 1day 1 week).
In the script you do the download and update part.
Hope it helps

I want to write multiple images to an odt file either in python or php

I want to write multiple image files to a odt file. I will be specifying a dir and the script will take it from there thru a loop. But where do i start? I have never done anything like this before!
I found this python code, which can convert html 2 python... so we can parse an html first and then call this one. But there is no reference on how to use this.
html2odt code
Atlast I found a PHP way to write odt direct! Its well documented.
http://www.odtphp.com/
I have also written a complete practical solution in php. You can upload multiple images and get the odt document generated.
The code is hosted at http://code.google.com/p/images2odt/
The first post is done here.
For anyone wanting to use the Python code will need a Python interpreter version 2.6. It might also work with version 2.7. It's mainly used in Linux but there are Windows and Mac versions as well. You will also need the files listed in the from and import statements. These files are in some of the other folders. It looks like it is a part of a much bigger Linux package. One last thing, Python scripts usually takes their arguments from a command line.
Additional info:
I looked over the setup.py file and it told me that this is an API library for open documents called odfpy. The version is 0.9.2. The link it has for the documentation is broken. A google search for odfpy came up with a place to download a more recent version (0.9.4) in a tarbell here:
http://pypi.python.org/pypi/odfpy
The documentation can be found here in an Open Office document:
https://joinup.ec.europa.eu/software/odfpy/document/api-odfpyodt

openoffice document (odt) to PDF with command line on Linux?

we are building a PHP script that we need at work to create reports in PDFs
the reports will be created by using templates from postgrSQL.
so far I found that it can be done with the use of php and odt (openoffice) files [http://www.odtphp.com/] (do you have any other suggestions?)
now how I can convert the results to PDF so teachers will get the final reports as PDF
any tips? the server has no GUI and I want to make it as simple as possible
we tried using PHP to PDF directly with FPDF [http://www.fpdf.org/] but it is really a CPU killer!
http://www.artofsolving.com/opensource/pyodconverter
this may help you, it needs to start OpenOffice as service, and the python script is merely utilizing its api, maybe you can write one in PHP too

Categories