当前位置: 首页>>代码示例>>PHP>>正文


PHP S3::getAuthenticatedURL方法代码示例

本文整理汇总了PHP中S3::getAuthenticatedURL方法的典型用法代码示例。如果您正苦于以下问题:PHP S3::getAuthenticatedURL方法的具体用法?PHP S3::getAuthenticatedURL怎么用?PHP S3::getAuthenticatedURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在S3的用法示例。


在下文中一共展示了S3::getAuthenticatedURL方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDownloadURL

 public static function getDownloadURL($item, $ttl = false)
 {
     self::requireLibrary();
     S3::setAuth(Z_CONFIG::$S3_ACCESS_KEY, Z_CONFIG::$S3_SECRET_KEY);
     if (!$item->isAttachment()) {
         throw new Exception("Item {$item->id} is not an attachment");
     }
     $info = self::getLocalFileItemInfo($item);
     if (!$info) {
         return false;
     }
     // Create expiring URL on Amazon and return
     $url = S3::getAuthenticatedURL(Z_CONFIG::$S3_BUCKET, self::getPathPrefix($info['hash'], $info['zip']) . $info['filename'], $ttl, false, true);
     return $url;
 }
开发者ID:robinpaulson,项目名称:dataserver,代码行数:15,代码来源:S3.inc.php

示例2: get

 function get($path)
 {
     $filenumber = intval($_GET['file']);
     $file = DB::get()->row('SELECT * FROM files WHERE id = :id', array('id' => $filenumber));
     if ($file) {
         header('Content-Type: application/octet-stream');
         header('Content-Disposition: attachment; filename=' . urlencode($file->filename) . ';');
         $url = parse_url($file->url);
         $bucket = str_replace('.s3.amazonaws.com', '', $url['host']);
         $access = DB::get()->assoc("SELECT name, value FROM options WHERE grouping = 'Amazon Web Services'");
         $s3 = new S3($access['AWS Access Key ID'], $access['AWS Secret Access Key']);
         $uri = $s3->getAuthenticatedURL($bucket, trim($url['path'], '/'), 3600);
         //readfile($file->url);
         header('location: ' . $uri);
         exit;
     }
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:17,代码来源:files.php

示例3: getAttachmentURL

 public function getAttachmentURL($attachment_id)
 {
     if (!$attachment_id) {
         throw new NotFoundException();
     }
     $attachment_id = (int) $attachment_id;
     $filename = $this->Response->query("\n            SELECT filename\n            FROM letters_responses_files\n            INNER JOIN\n              letters_responses\n                ON letters_responses.id = letters_responses_files.letter_response_id\n            WHERE\n              letters_responses_files.id = {$attachment_id} AND\n              letters_responses.user_id = " . $this->Auth->user('id') . "\n        ");
     if (!empty($filename[0]['letters_responses_files']['filename'])) {
         $filename = $filename[0]['letters_responses_files']['filename'];
     } else {
         throw new NotFoundException();
     }
     App::uses('S3', 'Vendor');
     $S3 = new S3(S3_LOGIN, S3_SECRET, null, S3_ENDPOINT);
     $bucket = 'portal';
     $file = 'letters/responses/' . $filename;
     $url = $S3->getAuthenticatedURL($bucket, $file, 60);
     if ($url) {
         $url = str_replace('s3.amazonaws.com/' . $bucket, $bucket . '.sds.tiktalik.com', $url);
     } else {
         throw new NotFoundException();
     }
     $this->setSerialized('url', $url);
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:24,代码来源:ResponsesController.php

示例4: S3

<?php

$contentEncoding = "UTF-8";
//include the S3 stuff
require_once 'myS3.php';
//instantiate the class
$s3 = new S3();
//create a new bucket (this will be ignored if bucket is already there)
$myBucketName = "robs-1st-bucket";
// Get the contents of our bucket
$bucket_contents = $s3->getBucket($myBucketName);
// Disable any caching in the brwoser.
header("Cache-Control: no-cache, no-store, max-age=0, must-revalidate");
header("Sat, 1 Jan 2000 00:00:00 GMT");
header("Pragma: no-cache");
header("Content-encoding: " . $contentEncoding);
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='" . $contentEncoding . "'?>";
echo "<images>";
foreach ($bucket_contents as $file) {
    $fname = $file['name'];
    $furl = S3::getAuthenticatedURL($myBucketName, $fname, 60, false, true);
    //$furl = "http://$myBucketName.s3.amazonaws.com/$fname";
    //output a link to each file
    echo "<image filename='{$fname}' url='{$furl}'/>";
}
echo "</images>";
开发者ID:RobBosman,项目名称:vanace.WebItems,代码行数:27,代码来源:getImagesS3.php

示例5: getAuthenticatedURL

 /**
  * Get a query string authenticated URL
  *
  * @param array $credentials AWS credentials
  * @param string $bucket Bucket name
  * @param string $uri Object URI
  * @param integer $lifetime Lifetime in seconds
  * @param boolean $hostBucket Use the bucket name as the hostname
  * @return string
  */
 public static function getAuthenticatedURL($credentials, $bucket, $uri, $lifetime, $hostBucket = false)
 {
     $s3 = new S3($credentials['AWS_ACCESS_KEY'], $credentials['AWS_SECRET_KEY'], $credentials['AWS_S3_SSL']);
     return $s3->getAuthenticatedURL($bucket, $uri, $lifetime, $hostBucket, $credentials['AWS_S3_SSL']);
 }
开发者ID:CpuID,项目名称:LocalS3Repo,代码行数:15,代码来源:LocalS3File.php

示例6: array

<?php

$success = false;
$result = array('status' => false);
if ($id = $this->DB->selectValue("SELECT `id` FROM `krs_files` WHERE `krs_pozycje_id`='" . addslashes($id) . "' AND `complete`='1' ORDER BY `complete_ts` DESC LIMIT 1")) {
    App::uses('S3', 'Vendor');
    $S3 = new S3(S3_LOGIN, S3_SECRET, null, S3_ENDPOINT);
    $bucket = 'resources';
    $file = 'KRS/' . $id . '.pdf';
    $url = $S3->getAuthenticatedURL($bucket, $file, 60);
    if ($url) {
        $url = str_replace('s3.amazonaws.com/' . $bucket, $bucket . '.sds.tiktalik.com', $url);
        $success = true;
    }
}
if ($success) {
    $result = array_merge($result, array('status' => true, 'url' => $url));
}
return $result;
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:19,代码来源:odpis.php

示例7: Facebook

} else {
    $returnurl = '/';
}
require_once 'config.php';
require_once './lib/facebook.php';
$okaytodownload = false;
// initialize the facebook API with your application API Key and Secret
$facebook = new Facebook(array('appId' => FACEBOOK_APPID, 'secret' => FACEBOOK_SECRET, 'cookie' => true));
$session = $facebook->getSession();
$fb_user = $session['uid'];
try {
    $testLikeStatus = $facebook->api(array('method' => 'pages.isfan', 'uid' => $fb_user, 'page_id' => FACEBOOK_FANPAGE_ID));
    if ($testLikeStatus) {
        if (SECURE_DOWNLOAD) {
            // use S3 secured download:
            require_once './lib/S3.php';
            if (!defined('AMAZONS3_KEY') || !defined('AMAZONS3_SECRET')) {
                header('Location: ./');
            }
            $s3 = new S3(AMAZONS3_KEY, AMAZONS3_SECRET);
            header("Location: " . S3::getAuthenticatedURL(AMAZONS3_BUCKET, DOWNLOAD_URI, 120));
        } else {
            // simple redirect:
            header('Location: ' . DOWNLOAD_URI);
        }
    } else {
        header('Location: ' . $returnurl . '?logout=1');
    }
} catch (FacebookApiException $e) {
    echo "There seems to be an error on the Facebook servers.";
}
开发者ID:Justharve,项目名称:FBConnect-to-Track,代码行数:31,代码来源:claimasset.php

示例8: getAuthenticatedUrl

 public function getAuthenticatedUrl()
 {
     $s3 = new S3('csub001050', 'studiomaiocchi', true, 'seewebstorage.it');
     $res = $s3->getAuthenticatedURL('studiomaiocchistaging', 'file.mp4', 60);
     return $res;
 }
开发者ID:EnricoSottile,项目名称:ammonio-sandbox,代码行数:6,代码来源:S3Service.php

示例9: authenticatedUrl

 /**
  * generate a url to authenticated content on S3
  * @param string $uri - Full URL to the S3 resource
  * @param integer $lifetime - number of seconds this url will be valid
  * @return string - Authenticated URL to access resource
  * @access public
  */
 public function authenticatedUrl($uri, $lifetime = 60)
 {
     $url = S3::getAuthenticatedURL($this->bucket, $this->relativePath($uri), $lifetime, false, $this->useSsl);
     return $url;
 }
开发者ID:dardosordi,项目名称:CakeS3,代码行数:12,代码来源:CakeS3Component.php

示例10: getAuthenticatedURL

 static function getAuthenticatedURL($bucket, $uri)
 {
     self::get_s3();
     return S3::getAuthenticatedURL($bucket, $uri, 60);
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:5,代码来源:aws_s3.php

示例11: get_s3_url

 /**
  * Returns a signed Amazon S3 download URL.
  *
  * @param $key          string  AWS key
  * @param $secret       string  AWS secret
  * @param $bucket       string  Bucket name
  * @param $file_name    string  File name (URI)
  * @return string       The signed download URL
  */
 public static function get_s3_url($key, $secret, $bucket, $file_name)
 {
     $s3 = new S3($key, $secret);
     // Duration 600 seconds (= 10 minutes)
     return $s3->getAuthenticatedURL($bucket, $file_name, 600);
 }
开发者ID:wangshipeng,项目名称:wp-license-manager,代码行数:15,代码来源:class-wp-license-manager-s3-fallback.php

示例12: s3AuthenticatedURL

 public static function s3AuthenticatedURL($uri)
 {
     S3::setAuth(S3_ACCESS_KEY, S3_SECRET_KEY);
     //Save logging status
     $save_logging = error_reporting();
     // Turn off logging for S3
     error_reporting(0);
     $authUrl = S3::getAuthenticatedURL(S3_BUCKET, $uri, 10 * 24 * 60 * 60, false, true);
     //10 days
     // Restore logging status
     error_reporting($save_logging);
     //Debug results from Auth access
     //error_log("s3Auth: $uri $authUrl");
     return $authUrl;
 }
开发者ID:MaitreyaBuddha,项目名称:worklist,代码行数:15,代码来源:File.php

示例13: mapQBAttachment

 function mapQBAttachment($name, $qb_rec, $field_name, &$data)
 {
     $s3 = new S3(AWS_ACCESS_KEY, AWS_SECRET_KEY);
     $url = $s3->getAuthenticatedURL('hipaasecurenow', $this->qbDbid . '_' . $qb_rec[RECORD_ID], 3600);
     $socket = new HttpSocket();
     $response = $socket->get($url);
     $tmp_name = sys_get_temp_dir() . '/' . $name;
     file_put_contents($tmp_name, $response->body);
     $attachment = array('name' => $name, 'type' => $response->getHeader('Content-Type'), 'tmp_name' => $tmp_name, 'error' => 0, 'size' => strlen($response->body));
     $data[$field_name] = $attachment;
 }
开发者ID:dipeshpatel306,项目名称:effective-adventure,代码行数:11,代码来源:AppModel.php

示例14: odpisy

 public function odpisy()
 {
     $id = (int) @$this->request->params['id'];
     $url = false;
     App::uses('S3', 'Vendor');
     $S3 = new S3(S3_LOGIN, S3_SECRET, null, S3_ENDPOINT);
     $bucket = 'resources';
     $file = 'KRS/' . $id . '.pdf';
     $url = $S3->getAuthenticatedURL($bucket, $file, 60);
     if ($url) {
         $url = str_replace('s3.amazonaws.com/' . $bucket, $bucket . '.sds.tiktalik.com', $url);
         $success = true;
     }
     $this->set('url', $url);
     $this->set('_serialize', array('url'));
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:16,代码来源:KrsAppController.php


注:本文中的S3::getAuthenticatedURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。