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


PHP curl::download方法代码示例

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


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

示例1: get_file

 public function get_file($url, $file = '')
 {
     global $CFG;
     //$CFG->repository_no_delete = true;
     $path = $this->prepare_file($file);
     $fp = fopen($path, 'w');
     $c = new curl();
     $c->download(array(array('url' => $url, 'file' => $fp)));
     return $path;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:10,代码来源:repository.class.php

示例2: get_file

 /**
  * Download a file from alfresco
  *
  * @param string $uuid a unique id of directory in alfresco
  * @param string $path path to a directory
  * @return array
  */
 public function get_file($uuid, $file = '') {
     $node = $this->user_session->getNode($this->store, $uuid);
     $url = $this->get_url($node);
     $path = $this->prepare_file($file);
     $fp = fopen($path, 'w');
     $c = new curl;
     $c->download(array(array('url'=>$url, 'file'=>$fp)));
     fclose($fp);
     return array('path'=>$path, 'url'=>$url);
 }
开发者ID:nigeli,项目名称:moodle,代码行数:17,代码来源:lib.php

示例3: create_from_url

 /**
  * Static method to create cache from url
  *
  * @param mixed $ref file reference
  * @param string $url file url
  * @param array $options options
  * @return string cached file path
  */
 public static function create_from_url($ref, $url, $options = array())
 {
     $instance = self::get_instance($options);
     $cachedfilepath = $instance->generate_filepath($ref);
     $fp = fopen($cachedfilepath, 'w');
     $curl = new curl();
     $curl->download(array(array('url' => $url, 'file' => $fp)));
     // Must close file handler.
     fclose($fp);
     return $cachedfilepath;
 }
开发者ID:rama1712,项目名称:moodle,代码行数:19,代码来源:filelib.php

示例4: get_file

 /**
  *
  * @global object $CFG
  * @param string $photo_id
  * @param string $file
  * @return string
  */
 public function get_file($photo_id, $file = '')
 {
     global $CFG;
     $info = $this->flickr->photos_getInfo($photo_id);
     if ($info['owner']['realname']) {
         $author = $info['owner']['realname'];
     } else {
         $author = $info['owner']['username'];
     }
     $copyright = get_string('author', 'repository') . ': ' . $author;
     $result = $this->flickr->photos_getSizes($photo_id);
     // download link
     $source = '';
     // flickr photo page
     $url = '';
     if (!empty($result[4])) {
         $source = $result[4]['source'];
         $url = $result[4]['url'];
     } elseif (!empty($result[3])) {
         $source = $result[3]['source'];
         $url = $result[3]['url'];
     } elseif (!empty($result[2])) {
         $source = $result[2]['source'];
         $url = $result[2]['url'];
     }
     $path = $this->prepare_file($file);
     $fp = fopen($path, 'w');
     $c = new curl();
     $c->download(array(array('url' => $source, 'file' => $fp)));
     // must close file handler, otherwise gd lib will fail to process it
     fclose($fp);
     if (!empty($this->usewatermarks)) {
         $img = new moodle_image($path);
         $img->watermark($copyright, array(10, 10), array('ttf' => true, 'fontsize' => 12))->saveas($path);
     }
     return array('path' => $path, 'url' => $url, 'author' => $info['owner']['realname'], 'license' => $this->license4moodle($info['license']));
 }
开发者ID:nmicha,项目名称:moodle,代码行数:44,代码来源:lib.php

示例5: get_file

 /**
  * Download a file, this function can be overridden by subclass. {@link curl}
  *
  * @param string $url the url of file
  * @param string $filename save location
  * @return array with elements:
  *   path: internal location of the file
  *   url: URL to the source (from parameters)
  */
 public function get_file($url, $filename = '') {
     global $CFG;
     $path = $this->prepare_file($filename);
     $fp = fopen($path, 'w');
     $c = new curl;
     $result = $c->download(array(array('url'=>$url, 'file'=>$fp)));
     // Close file handler.
     fclose($fp);
     if (empty($result)) {
         unlink($path);
         return null;
     }
     return array('path'=>$path, 'url'=>$url);
 }
开发者ID:nigeli,项目名称:moodle,代码行数:23,代码来源:lib.php

示例6: get_file

    /**
     * Download a file from alfresco - do we use this?
     *
     * @param string $uuid a unique id of directory in alfresco
     * @param string $path path to a directory
     * @return array|null
     */
    public function get_file($uuid, $file = '') {
        //error_log("get_file($uuid, '{$file}');");
        $node = $this->elis_files->get_info($uuid);
        if (empty($node)) {
            return null;
        }

        // Test to make sure this works with, say, a teacher or someone non-admin
        $username = '';

    /// Check for a non-text file type to just pass through to the end user.
        $mimetype = !empty($node->filemimetype) ? $node->filemimetype : '';
        $ticket = elis_files_utils_get_ticket('refresh', $username);
        $url = str_replace($node->filename, urlencode($node->filename), $node->fileurl) . '?alf_ticket=' .
               $ticket;

        $path = $this->prepare_file($file);
        $fp = fopen($path, 'w');
        $c = new curl;
        $response = $c->download(array(array('url'=>$url, 'file'=>$fp)));
        return array('path' => $path, 'url' => $url);
    }
开发者ID:jamesmcq,项目名称:elis,代码行数:29,代码来源:lib.php

示例7: get_file

 public function get_file($uuid, $file = '')
 {
     global $CFG;
     $node = $this->sess->getNode($this->store, $uuid);
     $url = $this->get_url($node);
     $path = $this->prepare_file($file);
     $fp = fopen($path, 'w');
     $c = new curl();
     $c->download(array(array('url' => $url, 'file' => $fp)));
     return $path;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:11,代码来源:repository.class.php


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