diff --git a/demo/fetch.php b/demo/fetch.php new file mode 100644 index 00000000..46e903dd --- /dev/null +++ b/demo/fetch.php @@ -0,0 +1,11 @@ +Bucket = 'rwxf'; +$pfop->Key = '1.mp4'; + +$savedKey = 'qiniu.jpg'; +$entry = Qiniu_Encode("$pfop->Bucket:$savedKey"); +$pfop->Fops = "vframe/jpg/offset/180/w/1000/h/1000/rotate/90|saveas/$entry"; + +list($ret, $err) = $pfop->MakeRequest($client); +echo "\n\n====> pfop result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/demo/sign_req.php b/demo/sign_req.php new file mode 100644 index 00000000..a57dbef8 --- /dev/null +++ b/demo/sign_req.php @@ -0,0 +1,10 @@ + $url); +$req = new Qiniu_Request($u, ''); +$mac = Qiniu_RequireMac(null); + +echo $mac->SignRequest($req, true); diff --git a/demo/up.php b/demo/up.php new file mode 100644 index 00000000..6922a57d --- /dev/null +++ b/demo/up.php @@ -0,0 +1,29 @@ +Scope = "$bucket:$key"; +$putPolicy->CallbackUrl = 'https://10fd05306325.a.passageway.io'; +$putPolicy->CallbackBody = 'key=$(key)&hash=$(etag)'; +$upToken = $putPolicy->Token(null); + +$putExtra = new Qiniu_PutExtra(); +$putExtra->Crc32 = 1; +$s = time(); +list($ret, $err) = Qiniu_PutFile($upToken, $key, $file, $putExtra); +echo "time elapse:". (time() - $s) . "\n"; +echo "\n\n====> Qiniu_PutFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} + diff --git a/qiniu/conf.php b/qiniu/conf.php index 67ff068c..7ff155fa 100644 --- a/qiniu/conf.php +++ b/qiniu/conf.php @@ -4,7 +4,7 @@ global $QINIU_UP_HOST; global $QINIU_RS_HOST; global $QINIU_RSF_HOST; - + global $QINIU_ACCESS_KEY; global $QINIU_SECRET_KEY; @@ -13,7 +13,8 @@ $QINIU_UP_HOST = 'http://up.qiniu.com'; $QINIU_RS_HOST = 'http://rs.qbox.me'; $QINIU_RSF_HOST = 'http://rsf.qbox.me'; +$QINIU_API_HOST = 'http://api.qiniu.com'; +$QINIU_IOVIP_HOST = 'http://iovip.qbox.me'; $QINIU_ACCESS_KEY = ''; $QINIU_SECRET_KEY = ''; - diff --git a/qiniu/pfop.php b/qiniu/pfop.php new file mode 100644 index 00000000..cd1a4db6 --- /dev/null +++ b/qiniu/pfop.php @@ -0,0 +1,48 @@ + $this->Bucket, + 'key' => $this->Key, + 'fops' => $this->Fops, + 'notifyURL' => $this->NotifyURL, + 'force' => $this->Force, + 'pipeline' => $this->Pipeline + ); + + $url = $QINIU_API_HOST . '/pfop/'; + + return Qiniu_Client_CallWithForm($self, $url, $ReqParams); + } + +} + +function Qiniu_PfopStatus($client, $id) +{ + global $QINIU_API_HOST; + + $url = $QINIU_API_HOST . '/status/get/prefop?'; + $params = array('id' => $id); + + return Qiniu_Client_CallWithForm($client, $url, $params); +} + + + diff --git a/qiniu/rs.php b/qiniu/rs.php index 425ba8f3..55a5090a 100644 --- a/qiniu/rs.php +++ b/qiniu/rs.php @@ -254,5 +254,16 @@ function Qiniu_RS_BatchCopy($self, $entryPairs) return Qiniu_RS_Batch($self, $params); } +// ---------------------------------------------------------- +// fetch +function Qiniu_RS_Fetch($self, $url, $bucket, $key) +{ + + global $QINIU_IOVIP_HOST; + $path = '/fetch/' . Qiniu_Encode($url) . '/to/' . Qiniu_Encode("$bucket:$key"); + return Qiniu_Client_CallNoRet($self, $QINIU_IOVIP_HOST . $path); +} + + // ----------------------------------------------------------