예제 #1
0
파일: errors.php 프로젝트: vuzit/vuzitphp
<?php

require_once '../lib/vuzit.php';
$exception = null;
$type = array_key_exists("type", $_GET) ? $_GET["type"] : null;
switch ($type) {
    case "bad_api_key":
        try {
            Vuzit_Service::setPublicKey('does not exist');
            $doc = Vuzit_Document::findById($show_id);
        } catch (Vuzit_ClientException $ex) {
            $exception = $ex;
        }
        break;
    case "doc_does_not_exist":
        try {
            $doc = Vuzit_Document::findById("doesnotexistblah");
        } catch (Vuzit_ClientException $ex) {
            $exception = $ex;
        }
        break;
    case "invalid_signature":
        try {
            Vuzit_Service::setPrivateKey('not_a_valid_key');
            $doc = Vuzit_Document::findById($show_id);
        } catch (Vuzit_ClientException $ex) {
            $exception = $ex;
        }
        break;
}
?>
예제 #2
0
$public_key = get("puk");
$private_key = get("prk");

if($public_key == null || $private_key == null)
{
  echo "Please provide the public (puk) and private (prk) keys";
  return;
}

$service_url = get("su");

if($service_url != null) {
  Vuzit_Service::setServiceUrl($service_url);
}

Vuzit_Service::setPublicKey($public_key);
Vuzit_Service::setPrivateKey($private_key);
Vuzit_Service::setUserAgent("Vuzit Test Suite");

// Grab the command and execute
switch(get("c"))
{
  case "load":
    load_command();
    break;
  case "upload":
    upload_command();
    break;
  case "delete":
    delete_command();
    break;