예제 #1
0
 /**
  * @param  string
  * @param  array  (string key => string value[, string key => string value[, ...]])
  * @return RESTResponse
  */
 public function call($method, $arguments = array(), $sign = false, $call_method = 'GET')
 {
     $extra_args = array('method' => $method, 'api_key' => $this->api_key);
     $arguments = is_array($arguments) ? $arguments + $extra_args : $extra_args;
     # sign call?
     if ($sign || in_array($method, self::$requires_signing)) {
         $arguments['api_sig'] = $this->computeSignature($arguments);
     }
     $res = parent::call('http://api.flickr.com/services/rest/', $arguments, $call_method);
     if (isset($res['err'])) {
         throw new RESTException($res['err'][0]['@']['msg'], intval($res['err'][0]['@']['code']));
     }
     return $res;
 }
예제 #2
0
<?php

require_once 'RESTService.php';
$request_method = strtolower($_SERVER['REQUEST_METHOD']);
$request_headers = http_get_request_headers();
$RESTService = new RESTService();
$RESTService->check_auth($request_headers);
if ($request_method == "get") {
    if (array_key_exists("id", $_GET)) {
        //echo $RESTService->get($_GET["id"]);
        echo $RESTService->getQueueEntry($_GET["id"]);
    } else {
        echo $RESTService->listQueueEntries();
    }
} else {
    if ($request_method == "put") {
        $request_body = http_get_request_body();
        $entry_object = json_decode($request_body)->entry;
        echo $RESTService->addQueueEntry($entry_object->build->id, $entry_object->priority, $entry_object->portdirectory, $entry_object->email_on_completion);
    }
}
예제 #3
0
<?php

require_once 'RESTService.php';
$request_method = strtolower($_SERVER['REQUEST_METHOD']);
$request_headers = http_get_request_headers();
$RESTService = new RESTService();
$RESTService->check_auth($request_headers);
if ($request_method == "get") {
    if (array_key_exists("id", $_GET)) {
        echo $RESTService->getBuild($_GET["id"]);
    } else {
        echo $RESTService->listBuilds();
    }
} else {
    echo "blah";
}
예제 #4
0
<?php

require_once 'RESTService.php';
$request_method = strtolower($_SERVER['REQUEST_METHOD']);
$request_headers = http_get_request_headers();
$RESTService = new RESTService();
$RESTService->check_auth($request_headers);
if ($request_method == "get") {
    print $RESTService->getLatestBuildPorts(10, null);
} else {
    echo "blah";
}