七牛重新整理介面php實現參考

三木發表於2016-09-08
<?php
require_once `../autoload.php`;

use QiniuAuth;
use QiniuHttpClient;


$accessKey = `accesskey`;
$secretKey = `secretkey`;
$auth = new Auth($accessKey, $secretKey);

function fusion(Auth $auth, $method, array $data = array())
{
  var_dump(json_encode($data));
  $headers = $auth->authorization(`http://fusion.qiniuapi.com/` . $method);
  $headers[`Content-Type`] = `application/json`;
  $res = Client::post(`http://fusion.qiniuapi.com/` . $method, json_encode($data), $headers);
  var_dump($headers);
  var_dump($res);
}

$urls = array(
              //`http://misc.rrcimg.com/dist/pc/js/search/search-a01198d1.js`,
              `http://itisatest.qiniudn.com/aaa/bbb/sss`,
);

$dirs = array(
              `http://itisatest.qiniudn.com/aaa/bbb/`,
              `http://itisatest.qiniudn.com/ccc/ddd/`,
);

$data = array(
              `urls` => $urls,
              //`dirs` => $dirs,
);

fusion($auth, `v2/tune/refresh`, $data);

相關文章