Skip to content

Commit 88643ba

Browse files
committed
Merge branch 'develop' of github.com:qiniu/php-sdk into develop
2 parents 1579589 + 5768edc commit 88643ba

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## CHANGE LOG
22

3+
### v6.1.9
4+
5+
2014-04-03 issues [#67](https://github.com/qiniu/php-sdk/pull/67)
6+
7+
- 新增3个新接口:fetch、prefetch、pfop的调用范例代码,需要使用这三个接口的用户可以参考。
8+
39
### v6.1.8
410

511
2014-4-6 issues [#68](https://github.com/qiniu/php-sdk/pull/68)

docs/gist/fetch.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
require_once("../../qiniu/http.php");
4+
require_once("../../qiniu/auth_digest.php");
5+
require_once("../../qiniu/utils.php");
6+
7+
$accessKey = "";
8+
$secretKey = "";
9+
$targetUrl = "";
10+
11+
$destBucket = "";
12+
$destKey = "";
13+
14+
$encodedUrl = Qiniu_Encode($targetUrl);
15+
16+
$destEntry = "$destBucket:$destKey";
17+
$encodedEntry = Qiniu_Encode($destEntry);
18+
19+
$apiHost = "http://iovip.qbox.me";
20+
$apiPath = "/fetch/$encodedUrl/to/$encodedEntry";
21+
$requestBody = "";
22+
23+
$mac = new Qiniu_Mac($accessKey, $secretKey);
24+
$client = new Qiniu_MacHttpClient($mac);
25+
26+
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
27+
if ($err !== null) {
28+
echo "failed\n";
29+
var_dump($err);
30+
} else {
31+
echo "success\n";
32+
}

docs/gist/pfop.php

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
require_once("../../qiniu/http.php");
4+
require_once("../../qiniu/auth_digest.php");
5+
require_once("../../qiniu/utils.php");
6+
7+
$accessKey = "";
8+
$secretKey = "";
9+
10+
$bucket = "";
11+
$key = "";
12+
$fops = "";
13+
$notifyURL = "";
14+
$force = 0;
15+
16+
17+
$encodedBucket = urlencode($bucket);
18+
$encodedKey = urlencode($key);
19+
$encodedFops = urlencode($fops);
20+
$encodedNotifyURL = urlencode($notifyURL);
21+
22+
$apiHost = "http://api.qiniu.com";
23+
$apiPath = "/pfop/";
24+
$requestBody = "bucket=$encodedBucket&key=$encodedKey&fops=$encodedFops&notifyURL=$encodedNotifyURL";
25+
if ($force !== 0) {
26+
$requestBody .= "&force=1";
27+
}
28+
29+
$mac = new Qiniu_Mac($accessKey, $secretKey);
30+
$client = new Qiniu_MacHttpClient($mac);
31+
32+
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
33+
if ($err !== null) {
34+
echo "failed\n";
35+
var_dump($err);
36+
} else {
37+
echo "success\n";
38+
var_dump($ret);
39+
}

docs/gist/prefetch.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
require_once("../../qiniu/http.php");
4+
require_once("../../qiniu/auth_digest.php");
5+
require_once("../../qiniu/utils.php");
6+
7+
$accessKey = "";
8+
$secretKey = "";
9+
10+
$bucket = "";
11+
$key = "";
12+
13+
$entry = "$bucket:$key";
14+
$encodedEntry = Qiniu_Encode($entry);
15+
16+
$apiHost = "http://iovip.qbox.me";
17+
$apiPath = "/prefetch/$encodedEntry";
18+
$requestBody = "";
19+
20+
$mac = new Qiniu_Mac($accessKey, $secretKey);
21+
$client = new Qiniu_MacHttpClient($mac);
22+
23+
list($ret, $err) = Qiniu_Client_CallWithForm($client, $apiHost . $apiPath, $requestBody);
24+
if ($err !== null) {
25+
echo "failed\n";
26+
var_dump($err);
27+
} else {
28+
echo "success\n";
29+
}

0 commit comments

Comments
 (0)