12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- require_once __DIR__ . '/../autoload.php';
- use Qiniu\Auth;
- use Qiniu\Processing\PersistentFop;
- $accessKey = getenv('QINIU_ACCESS_KEY');
- $secretKey = getenv('QINIU_SECRET_KEY');
- $auth = new Auth($accessKey, $secretKey);
- $bucket = getenv('QINIU_TEST_BUCKET');
- $key = 'qiniu.png';
- $pipeline = 'sdktest';
- $pfop = new PersistentFop($auth, null);
- $url1 = 'http://phpsdk.qiniudn.com/php-logo.png';
- $url2 = 'http://phpsdk.qiniudn.com/1.png';
- $zipKey = 'test.zip';
- $fops = 'mkzip/2/url/' . \Qiniu\base64_urlSafeEncode($url1);
- $fops .= '/url/' . \Qiniu\base64_urlSafeEncode($url2);
- $fops .= '|saveas/' . \Qiniu\base64_urlSafeEncode("$bucket:$zipKey");
- $notify_url = null;
- $force = false;
- list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notify_url, $force);
- echo "\n====> pfop mkzip result: \n";
- if ($err != null) {
- var_dump($err);
- } else {
- echo "PersistentFop Id: $id\n";
- }
- list($ret, $err) = $pfop->status($id);
- echo "\n====> pfop mkzip status: \n";
- if ($err != null) {
- var_dump($err);
- } else {
- var_dump($ret);
- }
|