Exporting and Importing .csv files using a script - php

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

Related

Read openstreetmap PBF file with PHP?

I downloaded a mbtiles file from this location:
https://openmaptiles.com/downloads/europe/netherlands/
I can serve this file in PHP with this library : https://github.com/klokantech/tileserver-php
This returns a compressed PBF, which Mapbox GL JS can use, but I'm not able in PHP to decode this data to get information out of it.
Has anybody ever extracted data from PBF using PHP ?
I know that this thread is a little bit old right now, but I will answer this anyway in case someone bumps into this issue.
You can use package named osm-pbf, for reading PBF files using PHP. As far as I know, it is currently the only option if you want to use PHP.
Link to package: https://github.com/franksierra/osm-pbf
Installation is fairly easy, you can just use composer.
The library itself is pretty slow, it takes around 8 minutes to read 300MB PBF file, but for smaller files it works like a charm.

working with php and python together

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.

How to create a MSEXCEL file using PHP

Good day,
How do i create an msexcel file using php script?
I have already prepared my data in a well structured array. I need
to be able to format my array into tables in msexcel.
the server where the WAMP server is running has no MS Office installed, would it
affect my objective to create the msexcel file. do i need to install on msoffice
in the server in case? fyi, i dont actually need to save the excel file in the server
but can be an option too.
thanks.
This is really a spin on DaveRandoms comment.
Make a CSV and set the mimetype to any of the ones in this SO question.
That way Excel (or any equivalent application) will start and show the file.
The PHPExcel library will let you take your data and write it into a valid Excel file, whether you need old-style XLS or new style XLSX format.
You don't need to have Excel installed on the server to use it.

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