• <legend id='COxpD'><style id='COxpD'><dir id='COxpD'><q id='COxpD'></q></dir></style></legend>
      <bdo id='COxpD'></bdo><ul id='COxpD'></ul>
  • <tfoot id='COxpD'></tfoot>

      1. <small id='COxpD'></small><noframes id='COxpD'>

        <i id='COxpD'><tr id='COxpD'><dt id='COxpD'><q id='COxpD'><span id='COxpD'><b id='COxpD'><form id='COxpD'><ins id='COxpD'></ins><ul id='COxpD'></ul><sub id='COxpD'></sub></form><legend id='COxpD'></legend><bdo id='COxpD'><pre id='COxpD'><center id='COxpD'></center></pre></bdo></b><th id='COxpD'></th></span></q></dt></tr></i><div id='COxpD'><tfoot id='COxpD'></tfoot><dl id='COxpD'><fieldset id='COxpD'></fieldset></dl></div>

        需要php脚本下载远程服务器上的文件并保存到本地

        Need php script to download a file on a remote server and save locally(需要php脚本下载远程服务器上的文件并保存到本地)
              <i id='wXUlZ'><tr id='wXUlZ'><dt id='wXUlZ'><q id='wXUlZ'><span id='wXUlZ'><b id='wXUlZ'><form id='wXUlZ'><ins id='wXUlZ'></ins><ul id='wXUlZ'></ul><sub id='wXUlZ'></sub></form><legend id='wXUlZ'></legend><bdo id='wXUlZ'><pre id='wXUlZ'><center id='wXUlZ'></center></pre></bdo></b><th id='wXUlZ'></th></span></q></dt></tr></i><div id='wXUlZ'><tfoot id='wXUlZ'></tfoot><dl id='wXUlZ'><fieldset id='wXUlZ'></fieldset></dl></div>

            1. <tfoot id='wXUlZ'></tfoot>
              • <small id='wXUlZ'></small><noframes id='wXUlZ'>

                  <bdo id='wXUlZ'></bdo><ul id='wXUlZ'></ul>
                    <tbody id='wXUlZ'></tbody>

                • <legend id='wXUlZ'><style id='wXUlZ'><dir id='wXUlZ'><q id='wXUlZ'></q></dir></style></legend>

                • 本文介绍了需要php脚本下载远程服务器上的文件并保存到本地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  尝试在远程服务器上下载文件并将其保存到本地子目录.

                  Trying to download a file on a remote server and save it to a local subdirectory.

                  以下代码似乎适用于小文件,<1MB,但较大的文件会超时,甚至无法开始下载.

                  The following code seems to work for small files, < 1MB, but larger files just time out and don't even begin to download.

                  <?php
                  
                   $source = "http://someurl.com/afile.zip";
                   $destination = "/asubfolder/afile.zip";
                  
                   $data = file_get_contents($source);
                   $file = fopen($destination, "w+");
                   fputs($file, $data);
                   fclose($file);
                  
                  ?>
                  

                  关于如何不间断地下载较大文件的任何建议?

                  Any suggestions on how to download larger files without interruption?

                  推荐答案

                  $ch = curl_init();
                  $source = "http://someurl.com/afile.zip";
                  curl_setopt($ch, CURLOPT_URL, $source);
                  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                  $data = curl_exec ($ch);
                  curl_close ($ch);
                  
                  $destination = "/asubfolder/afile.zip";
                  $file = fopen($destination, "w+");
                  fputs($file, $data);
                  fclose($file);
                  

                  这篇关于需要php脚本下载远程服务器上的文件并保存到本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                  How to parse django style template tags(如何解析 django 样式模板标签)
                  What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                  How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                  What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                  php in background exec() function(php 后台 exec() 函数)
                    <bdo id='59gWP'></bdo><ul id='59gWP'></ul>
                      <i id='59gWP'><tr id='59gWP'><dt id='59gWP'><q id='59gWP'><span id='59gWP'><b id='59gWP'><form id='59gWP'><ins id='59gWP'></ins><ul id='59gWP'></ul><sub id='59gWP'></sub></form><legend id='59gWP'></legend><bdo id='59gWP'><pre id='59gWP'><center id='59gWP'></center></pre></bdo></b><th id='59gWP'></th></span></q></dt></tr></i><div id='59gWP'><tfoot id='59gWP'></tfoot><dl id='59gWP'><fieldset id='59gWP'></fieldset></dl></div>
                      <legend id='59gWP'><style id='59gWP'><dir id='59gWP'><q id='59gWP'></q></dir></style></legend><tfoot id='59gWP'></tfoot>

                            <tbody id='59gWP'></tbody>
                          1. <small id='59gWP'></small><noframes id='59gWP'>