PHP code example of conversiontools / conversiontools-php

1. Go to this page and download the library: Download conversiontools/conversiontools-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

conversiontools / conversiontools-php example snippets






ConversionTools\ConversionClient;

// put token here from your Profile page at https://conversiontools.io/profile
$token = '';

$fileOrUrlInput = 'test.xml';
$fileOutput = 'test.csv';

$options = ['delimiter' => 'tabulation'];

$client = new ConversionClient($token);
try {
    $client->convert('convert.xml_to_csv', $fileOrUrlInput, $fileOutput, $options);
} catch (Exception $e) {
    print 'Exception: ' . $e->getMessage() . "\n";
}



ConversionTools\ConversionClient;

// put token here from your Profile page at https://conversiontools.io/profile
$token = '';

$fileOrUrlInput = 'https://google.com';
$fileOutput = 'result.pdf';

$options = [];

$client = new ConversionClient($token);
try {
    $client->convert('convert.website_to_pdf', $fileOrUrlInput, $fileOutput, $options);
} catch (Exception $e) {
    print 'Exception: ' . $e->getMessage() . "\n";
}

use \ConversionTools\ConversionClient;

$client = new ConversionClient('<token>');

$client = new ConversionClient($token);
try {
    $client->convert('<conversion type>', $fileOrUrlInput, $fileOutput, $options);
} catch (Exception $e) {
    print 'Exception: ' . $e->getMessage() . "\n";
}

$options = ['delimiter' => 'tabulation'];
bash
composer