Skip to content

vuzit/vuzitphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

--------------------------------------------------
-- VuzitPHP, Vuzit Web Services library for PHP
--------------------------------------------------


--------------------------------------------------
-- INTRODUCTION
--------------------------------------------------

This is a library that allows developers to directly access the Vuzit Web 
Service API through a simple PHP script:

  http://vuzit.com/developer/web_service_api

Below is a basic upload example:

  <?php  
  include_once "VuzitPHP/lib/vuzit.php";  

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');  
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');  

  $doc = Vuzit_Document::upload("c:/path/to/document.pdf");  

  echo "Document id: " . $doc->getId();  
  ?>

To get started all you need to do is download the code, sign up for a free 
account (https://ssl.vuzit.com/signup) and replace the public and 
private keys with the keys from your account.
  
--------------------------------------------------
-- INITIAL SETUP
--------------------------------------------------

This application requires the PHP Client Library (libcurl):

  http://php.net/curl
  
This link is to the installation instructions:

  http://php.net/manual/en/curl.installation.php

A simple phpinfo() call will tell you if CURL is installed:

<?php
phpinfo();
?>
  
If you're using the Windows version then the library is an optional module.  
Open your php.ini file and un-comment the following line:

extension=php_curl.dll

Then restart your web server.  Verify with the phpinfo() call that it's 
working.  Sometimes on Windows machines the php.ini 'extension_dir' variable 
is set to ./ which doesn't work.  You will need to give it the full path.  
In this example the PHP installation is stored in "C:\Program Files\php":
  
extension_dir = "C:/Program Files/php/ext"


--------------------------------------------------
-- GETTING STARTED 
--------------------------------------------------

* Download the code - http://github.com/vuzit/vuzitphp/downloads
* Sign up for a free Vuzit account - https://ssl.vuzit.com/signup
* Code Examples - http://wiki.github.com/vuzit/vuzitphp/code_examples
* Vuzit API Reference - http://wiki.github.com/vuzit/vuzitphp/api_reference


--------------------------------------------------
-- EXAMPLES
--------------------------------------------------

Find Document Example - how to load a document

  <?php
  include_once "VuzitPHP/lib/vuzit.php";

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');

  $doc = Vuzit_Document::find("DOCUMENT_ID");
  echo "Document id: " . $doc->getId();
  echo "Document title: " . $doc->getTitle();
  ?>

Delete (destroy) Document Example

  <?php
  include_once "VuzitPHP/lib/vuzit.php";

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');

  Vuzit_Document::destroy("DOCUMENT_ID");
  ?>

Upload and View with the JavaScript API Example

  <?php
  include_once "VuzitPHP/lib/vuzit.php";
  
  $doc = Vuzit_Document::upload("c:/temp/test.pdf");
  $timestamp = time();
  $sig = Vuzit_Service::signature("show", $doc->getId(), $timestamp);
  ?>
  <html>
    <head>
      <link href="http://vuzit.com/stylesheets/Vuzit-2.9.css" rel="Stylesheet" type="text/css" />
      <script src="http://vuzit.com/javascripts/Vuzit-2.9.js" type="text/javascript"></script>
      <script type="text/javascript">
        // Called when the page is loaded.  
        function initialize()  {
          vuzit.Base.apiKeySet("<?php echo Vuzit_Service::getPublicKey(); ?>"); 
          var options = {signature: '<?php echo rawurlencode($sig); ?>', 
                         timestamp: '<?php echo $timestamp ?>', ssl: true}
          var viewer = vuzit.Viewer.fromId("<?php echo $doc->getId(); ?>", options);
          
          viewer.display(document.getElementById("vuzit_viewer"), { zoom: 1 });
        }
      </script>
    </head>
    <body onload="initialize()">
      <div id="vuzit_viewer" style="width: 650px; height: 500px;"></div>
    </body>
  </html>


--------------------------------------------------
-- MORE INFORMATION
--------------------------------------------------

For more information, including installation visit:

  http://vuzit.com/developer


--------------------------------------------------
-- LICENSE
--------------------------------------------------

Copyright (c) 2009-2010 Brent Matzelle, Vuzit LLC 

Released under the MIT license: 

  http://www.opensource.org/licenses/mit-license.php

This means you can use it in proprietary products. See LICENSE file.


--------------------------------------------------
-- Feature Requests and Bug Reports
--------------------------------------------------

  Email to support AT vuzit DOT com

About

PHP 5 library for the Vuzit AJAX document viewer web services API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages