A simple PHP script to demonstrate usage of the Zamzar file conversion API.
The script:
- Uploads a file for conversion
- Polls the API to verify if the conversion job has completed
- Downloads any converted files when it has completed
Make sure you have:
- A version of PHP >5.3 installed.
- Registered for a Zamzar API account and have a valid API key that you can use.
- Change the
YOUR_API_KEY
to use your Zamzar API key - Modify
$sourceFilePath
to point to a file on your local filesystem you wish to convert - Update
$convertedFilePath
to use a path on your local filesystem where you wish to save any converted files. - Change
$targetFormat
to the name of a target format you wish to convert your file to (check here for a full list of supported formats). - Run the script from the command line using:
php zamzar-sample.php
For further information check out the Zamzar API docs here.