MakeRequest() public method

public MakeRequest ( $baseUrl, $mac )
Example #1
0
 public function get_sign_url($object)
 {
     $domain = $this->bucket . ".qiniudn.com";
     $baseUrl = Qiniu_RS_MakeBaseUrl($domain, $object);
     $getPolicy = new Qiniu_RS_GetPolicy();
     $privateUrl = $getPolicy->MakeRequest($baseUrl, null);
     return $privateUrl;
 }
 public function buildPriUrl($key, $domain)
 {
     $accessKey = C('QINIU_ACCESS_KEY');
     $secretKey = C('QINIU_SECRET_KEY');
     Qiniu_setKeys($accessKey, $secretKey);
     // $baseUrl 就是您要访问资源的地址
     $baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key);
     $getPolicy = new \Qiniu_RS_GetPolicy();
     $privateUrl = $getPolicy->MakeRequest($baseUrl, null);
     echo $privateUrl;
 }
 /**
  * $filename 七牛可以手动填写路径
  */
 function sendToQiniu($path, $filename)
 {
     Qiniu_setKeys(self::$qiniuAccessKey, self::$qiniuSecretKey);
     $qiniu = new Qiniu_MacHttpClient(null);
     $putPolicy = new Qiniu_RS_PutPolicy(self::$bucket);
     $upToken = $putPolicy->Token(null);
     $putExtra = new Qiniu_PutExtra();
     $putExtra->Crc32 = 1;
     list($ret, $err) = Qiniu_PutFile($upToken, $filename, $path, $putExtra);
     if ($err) {
         return array('code' => -2, 'msg' => $err);
     } else {
         $file = $ret['key'];
         $domain = self::$bucket . '.qiniudn.com';
         $baseUrl = Qiniu_RS_MakeBaseUrl($domain, $file);
         $private = false;
         if ($private) {
             $getPolicy = new Qiniu_RS_GetPolicy();
             $baseUrl = $getPolicy->MakeRequest($baseUrl, null);
         }
         return array('code' => 0, 'msg' => $baseUrl);
     }
 }
Example #4
0
 /**
  * 获取私有资源地址(公有资源一样可用)
  * @param $path
  * @return string
  */
 public function getPrivateUrl($path)
 {
     $getPolicy = new \Qiniu_RS_GetPolicy();
     return $getPolicy->MakeRequest($this->getUrl($path), null);
 }
Example #5
0
 public static function getPrivateUrl($baseUrl)
 {
     Qiniu_SetKeys(W2Config::$Qiniu_accessKey, W2Config::$Qiniu_secretKey);
     $getPolicy = new Qiniu_RS_GetPolicy();
     $getPolicy->Expires = 3600;
     $privateUrl = $getPolicy->MakeRequest($baseUrl, null);
     return $privateUrl;
 }
Example #6
0
$imgInfo = new Qiniu_ImageInfo();
//生成fopUrl
$imgInfoUrl = $imgInfo->MakeRequest($baseUrl);
//对fopUrl 进行签名,生成privateUrl。 公有bucket 此步可以省去。
$imgInfoPrivateUrl = $getPolicy->MakeRequest($imgInfoUrl, null);
echo "\n\n====> imageInfo privateUrl: \n";
echo $imgInfoPrivateUrl . "\n";
# @endgist
# @gist image_exif
$getPolicy = new Qiniu_RS_GetPolicy();
$imgExif = new Qiniu_Exif();
//生成fopUrl
$imgExifUrl = $imgExif->MakeRequest($baseUrl);
//对fopUrl 进行签名,生成privateUrl。 公有bucket 此步可以省去。
$imgExifPrivateUrl = $getPolicy->MakeRequest($imgExifUrl, null);
echo "\n\n====> imageView privateUrl: \n";
echo $imgExifPrivateUrl . "\n";
# @endgist
# @gist image_view
$getPolicy = new Qiniu_RS_GetPolicy();
$imgView = new Qiniu_ImageView();
$imgView->Mode = 1;
$imgView->Width = 60;
$imgView->Height = 30;
//生成fopUrl
$imgViewUrl = $imgView->MakeRequest($baseUrl);
//对fopUrl 进行签名,生成privateUrl。 公有bucket 此步可以省去。
$imgViewPrivateUrl = $getPolicy->MakeRequest($imgViewUrl, null);
echo "\n\n====> imageView privateUrl: \n";
echo $imgViewPrivateUrl . "\n";
# @endgist
Example #7
0
 public function getPrivateUrl($key)
 {
     $this->change2PrivateDomain();
     Qiniu_setKeys(QINIU_ACCESS_KEY, QINIU_SECRET_KEY);
     $baseUrl = Qiniu_RS_MakeBaseUrl($this->domain, $key);
     $getPolicy = new \Qiniu_RS_GetPolicy();
     return $getPolicy->MakeRequest($baseUrl, null);
 }
Example #8
0
    var_dump($ret);
}
Qiniu_RS_Delete($client, $bucket, $key1);
$putExtra = new Qiniu_PutExtra();
$putExtra->Crc32 = 1;
list($ret, $err) = Qiniu_PutFile($upToken, $key1, __FILE__, null);
echo "\n\n====> Qiniu_PutFile result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);
}
Qiniu_RS_Delete($client, $bucket, $key1);
$baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key);
$getPolicy = new Qiniu_RS_GetPolicy();
$privateUrl = $getPolicy->MakeRequest($baseUrl, null);
echo "\n\n====> getPolicy result: \n";
echo $privateUrl . "\n";
//------------------------------------fop-----------------------------------------
$imgInfo = new Qiniu_ImageInfo();
$imgInfoUrl = $imgInfo->MakeRequest($baseUrl);
$imgInfoPrivateUrl = $getPolicy->MakeRequest($imgInfoUrl, null);
echo "\n\n====> imageInfo privateUrl: \n";
echo $imgInfoPrivateUrl . "\n";
$imgExif = new Qiniu_Exif();
$imgExifUrl = $imgExif->MakeRequest($baseUrl);
$imgExifPrivateUrl = $getPolicy->MakeRequest($imgExifUrl, null);
echo "\n\n====> imageView privateUrl: \n";
echo $imgExifPrivateUrl . "\n";
$imgView = new Qiniu_ImageView();
$imgView->Mode = 1;
Example #9
0
function picThumb($accessKey, $secretKey, $key1, $width, $height)
{
    // --------------------------压缩图片 start
    //    require_once('qiniu/rs.php');
    require_once 'qiniu/fop.php';
    $key1 = $key1;
    $domain = 'zhaoliwu.qiniudn.com';
    Qiniu_setKeys($accessKey, $secretKey);
    //$baseUrl 就是您要访问资源的地址
    $baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key1);
    $getPolicy = new Qiniu_RS_GetPolicy();
    $imgView = new Qiniu_ImageView();
    $imgView->Mode = 1;
    $imgView->Width = $width;
    $imgView->Height = $height;
    //生成fopUrl
    $imgViewUrl = $imgView->MakeRequest($baseUrl);
    //对fopUrl 进行签名,生成privateUrl。 公有bucket 此步可以省去。
    $imgViewPrivateUrl = $getPolicy->MakeRequest($imgViewUrl, null);
    echo "\n\n====> imageView privateUrl: \n";
    echo $imgViewPrivateUrl . "\n";
    // ------------------------------------ end
}
Example #10
0
 function getStream($path, $fop)
 {
     $arr = self::parsePath($path);
     $client = self::init($path, 1);
     try {
         $baseUrl = Qiniu_RS_MakeBaseUrl($this->_domain, $arr['object']) . ($fop ? '?' . $fop : '');
         $getPolicy = new Qiniu_RS_GetPolicy();
         return $getPolicy->MakeRequest($baseUrl, null);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Example #11
0
 public function download($key)
 {
     $getPolicy = new Qiniu_RS_GetPolicy();
     return $getPolicy->MakeRequest(Qiniu_RS_MakeBaseUrl($this->_Domain, $key), null);
 }