Changeset 20951


Ignore:
Timestamp:
2011/05/20 21:40:28 (13 years ago)
Author:
Ringo
Message:

#144 (郵便番号DB のアップデート) * Proxy対応。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php

    r20945 r20951  
    2424// {{{ requires 
    2525require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php'; 
     26require_once DATA_REALDIR . 'module/Request.php'; 
    2627 
    2728/** CSV ファイルの最大行数 */ 
     
    364365     */ 
    365366    function lfDownloadZipFileFromJp() { 
    366         $res = copy($this->zip_download_url, $this->zip_csv_temp_realfile); 
    367         if (!$res) { 
    368             SC_Utils_Ex::sfDispException($this->zip_download_url . ' の取得または ' . $this->zip_csv_temp_realfile . ' への書き込みに失敗しました。'); 
    369         } 
     367       // Proxy経由を可能とする。         
     368       // TODO Proxyの設定は「DATA_REALDIR . 'module/Request.php'」内の「function HTTP_Request」へ記述する。いずれは、外部設定としたい。 
     369       $req = new HTTP_Request(); 
     370       $req->setURL($this->zip_download_url); 
     371        
     372        // 郵便番号CSVをdownloadする。 
     373       $res1 = $req->sendRequest(); 
     374        
     375       if ($res1) { 
     376            // 郵便番号CSV(zip file)を保存する。 
     377           $fp = fopen($this->zip_csv_temp_realfile, 'w'); 
     378           $res2 = fwrite($fp, $req->getResponseBody()); 
     379        } 
     380       if (!$res1 or !$res2) { 
     381            // 郵便番号CSVの「downloadに失敗」または「書き込みに失敗」 
     382           SC_Utils_Ex::sfDispException($this->zip_download_url . ' の取得または ' . $this->zip_csv_temp_realfile . ' への書き込みに失敗しました。'); 
     383       } 
    370384    } 
    371385 
Note: See TracChangeset for help on using the changeset viewer.