PHP code example of zimbra-api / upload-api

1. Go to this page and download the library: Download zimbra-api/upload-api 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/ */

    

zimbra-api / upload-api example snippets




imbra\Upload\Client;
use Zimbra\Upload\Request;

$file = new \SplFileInfo($filePath);
$request = new Request([$file], $requestId, $authToken);
$client = new Client('https://zimbra.server/service/upload');
$attachments = $client->upload($request);



imbra\Account\AccountApi;

$api = new AccountApi('https://zimbra.server/service/soap');
$auth = $api->authByName('username', 'password');
$authToken = $auth->getAuthToken();