1. Go to this page and download the library: Download donutdan4114/box-view-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/ */
donutdan4114 / box-view-api example snippets
$api_key = 'YOUR_API_KEY';
$box = new Box_View_API($api_key);
$doc = new Box_View_Document();
$doc->name = 'My Awesome Document';
$doc->file_url = 'http://my-public-url';
$doc->thumbnails = '128×128,256×256'; // Comma-separated list of thumbnail dimensions of the format {width}x{height} e.g. 128×128,256×256
$doc->non_svg = false; // boolean (default=false)
$box->upload($doc);
$doc = new Box_View_Document(array(
'name' => 'My Local File',
'file_path' => '/path/to/file/CV_Template1.doc',
));
$box->upload($doc);
// Create array of Box_View_Document objects.
$docs[] = new Box_View_Document(array('file_url' => 'http://foo.bar/why-cats-purrrr.pdf'));
$docs[] = new Box_View_Document(array('file_url' => 'http://foo.bar/10-ways-to-love-your-cat.docx'));
$docs[] = new Box_View_Document(array('file_url' => 'http://foo.bar/funny-cat-links.xlsx'));
// Wrap API calls in try/catch.
try
{
$box->uploadMultiple($docs);
}
catch(Exception $e)
{
log('error', $e->getMessage());
}
$box->view($doc);
echo $doc->session->url; // Links to the HTML5 document.