Exemplo n.º 1
0
 public static function status($id)
 {
     $url = Config::API_HOST . "/status/get/prefop?id={$id}";
     $response = Client::get($url);
     if (!$response->ok()) {
         return array(null, new Error($url, $response));
     }
     return array($response->json(), null);
 }
Exemplo n.º 2
0
 /**
  * 对资源文件进行处理
  *
  * @param $key   待处理的资源文件名
  * @param $fops   string|array  fop操作,多次fop操作以array的形式传入。
  *                eg. imageView2/1/w/200/h/200, imageMogr2/thumbnail/!75px
  *
  * @return array 文件处理后的结果及错误。
  *
  * @link http://developer.qiniu.com/docs/v6/api/reference/fop/
  */
 public function execute($key, $fops)
 {
     $url = $this->buildUrl($key, $fops);
     $resp = Client::get($url);
     if (!$resp->ok()) {
         return array(null, new Error($url, $resp));
     }
     if ($resp->json() !== null) {
         return array($resp->json(), null);
     }
     return array($resp->body, null);
 }
Exemplo n.º 3
0
 private function get($url)
 {
     $headers = $this->auth->authorization($url);
     $ret = Client::get($url, $headers);
     if (!$ret->ok()) {
         return array(null, new Error($url, $ret));
     }
     return array($ret->json(), null);
 }