久久久久久久性爱潮,国产又粗又猛又爽又黄下载视频,尤物国产在线一区视频,欧美日本国产在线不卡

<sup id="4uqqy"><ol id="4uqqy"></ol></sup>
  • <th id="4uqqy"></th>

      • <strike id="4uqqy"><nobr id="4uqqy"><ins id="4uqqy"></ins></nobr></strike><sup id="4uqqy"></sup><strong id="4uqqy"><u id="4uqqy"></u></strong>
        <sub id="4uqqy"></sub>

          綠色資源網(wǎng):您身邊最放心的安全下載站! 最新軟件|熱門排行|軟件分類|軟件專題|廠商大全

          綠色資源網(wǎng)

          技術(shù)教程
          您的位置:首頁網(wǎng)絡(luò)編程PHP編程 → 用php實(shí)現(xiàn)遠(yuǎn)程網(wǎng)絡(luò)文件下載到服務(wù)器

          用php實(shí)現(xiàn)遠(yuǎn)程網(wǎng)絡(luò)文件下載到服務(wù)器

          我要評論 2009/09/14 11:55:39 來源:綠色資源網(wǎng) 編輯:Downcc資源站 [ ] 評論:0 點(diǎn)擊:520次

          本文主要介紹如何用php程序?qū)崿F(xiàn)將遠(yuǎn)程網(wǎng)絡(luò)文件下載到自己的主機(jī)(服務(wù)器、虛擬主機(jī))上,當(dāng)然也提供asp、asp.net的源碼給大家參考.

          最近讓 Lc. 下載《汪洋中的一條船》這部感人的勵志電視劇,為了分享方便,于是我提供一個Godaddy的免費(fèi)FTP.

          考慮到穩(wěn)定性和專一性,我想重新開啟一個godaddy的免費(fèi)空間,但是此時已經(jīng)上傳了兩集,一共是400多兆.怎么辦呢?

          于是乎我想起了之前轉(zhuǎn)移空間時用到的一個php文件,他可以下載遠(yuǎn)程網(wǎng)絡(luò)文件到服務(wù)器上,也就是只要是可以下載的url,就可以轉(zhuǎn)移到新的服務(wù)器上.

          廢話不多說,直接亮出將遠(yuǎn)程網(wǎng)絡(luò)文件下載到服務(wù)器的php源碼(測試通過,很好很強(qiáng)大).

           <form method="post">
          <input name="url" size="50" />
          <input name="submit" type="submit" />
          </form>
          < ?php
          // maximum execution time in seconds
          set_time_limit (24 * 60 * 60);
          if (!isset($_POST['submit'])) die();
          // folder to save downloaded files to. must end with slash
          $destination_folder = 'temp/';
           
          $url = $_POST['url'];
          $newfname = $destination_folder . basename($url);
          $file = fopen ($url, "rb");
          if ($file) {
          $newf = fopen ($newfname, "wb");
          if ($newf)
          while(!feof($file)) {
          fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
          }
          }
          if ($file) {
          fclose($file);
          }
          if ($newf) {
          fclose($newf);
          }
          ?>

          當(dāng)然還需要展示下asp版本的源碼(未測試)

          < %
          function   downfilea(d_target,   s_target)
          On   Error   Resume   Next  
              dim   myhttp,   objstream
              set   myhttp   =   server.createobject( "MSXML2.XMLHTTP ")
              myhttp.open   "GET ",   d_target,   false
              myhttp.send()
              set   objstream   =   Server.CreateObject( "adodb.stream ")  
              objstream.Type   =   1  
              objstream.Mode   =   3  
              objstream.Open
              objstream.Write   myhttp.responseBody
              objstream.SaveToFile   s_target,   2
              if   err.number   <>   0   then   err.Clear
          end   function
           
          downfilea   "http://www.abc.com/xxx.rar ",   Server.MapPath( "down/xxx.rar ")
          Response.write   "ok "
          %>

          還有asp.net版本的源碼(未測試)

             using   System;  
            using   System.Net;  
            using   System.IO;  
           
            class   DownloadFile;  
                {  
                  static   void   Main(string[]   args)  
                      {  
                          //你的遠(yuǎn)程文件  
                          string   siteURL="http://www.abc.com/xxx.rar";  
                          //下載到本地的路徑及文件名  
                          string   fileName="c:\\xxx.rar";  
                          //實(shí)例化一個WebClient  
                          WebClient   client=new   WebClient();  
                          //調(diào)用WebClient的DownloadFile方法  
                          client.DownloadFile(siteURL,fileName);  
                          }  
                  }

          注意事項:

          1.相關(guān)的目錄可能需要建立,具體請看源碼.比如temp/、down/.

          2.其中php版本的源碼是支持自定義url的,但asp、asp.net版本的并沒有提供自定義.

          3.在拷貝大文件時,國內(nèi)估計支持欠佳.因為考慮到程序的超時時間,但在國外支持很好.

          比如Blinux將一個近300M的文件轉(zhuǎn)移到另一個服務(wù)器上耗費(fèi)時間是28秒.這是國內(nèi)無法想象的.

          最后希望大家反饋下使用效果.

          關(guān)鍵詞:php,服務(wù)器

          閱讀本文后您有什么感想? 已有 人給出評價!

          • 1 歡迎喜歡
          • 2 白癡
          • 1 拜托
          • 1 哇
          • 1 加油
          • 1 鄙視