歡迎光臨, 訪客. 請先 登入註冊一個帳號.
四月 24, 2024, 03:58:12 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  外掛程式  |  flickr的問題 « 上篇主題 下篇主題 »
頁: [1]
作者 主題: flickr的問題  (閱讀 13802 次)
Figs
新手見習
*
文章: 3



檢視個人資料 個人網站
« 於: 八月 10, 2005, 03:01:12 下午 »

我在自己的虛擬主機測試flickr外掛出現底下問題
但在Mark的pLog 測試站台測試澤沒問題, 請高手協助...  我的虛擬主機為dreamhost
Exception message: fopen(): URL file-access is disabled in the server configuration
Error code: 2
-- Backtrace --
/home/.barrett/figs/do4jesus.org/net/plugins/flickr/pluginflickr.class.php(371): fopen
/home/.barrett/figs/do4jesus.org/net/plugins/flickr/pluginflickr.class.php(113): pluginflickr.cached_get_file_contents
/home/.barrett/figs/do4jesus.org/net/tmp/14/%%-13^%%-1335910901^flickr.template.php(170): pluginflickr.getphotolist
/home/.barrett/figs/do4jesus.org/net/class/template/smarty/Smarty.class.php(1281): include
/home/.barrett/figs/do4jesus.org/net/class/template/template.class.php(120): smarty.fetch
/home/.barrett/figs/do4jesus.org/net/class/view/smartyview.class.php(190): template.fetch
/home/.barrett/figs/do4jesus.org/net/class/view/blogview.class.php(224): smartyview.render
/home/.barrett/figs/do4jesus.org/net/class/controller/controller.class.php(325): blogview.render
/home/.barrett/figs/do4jesus.org/net/index.php(68): blogcontroller.process

Exception message: fopen(http://www.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=642d5965f8ecba92fb78ff5d83993a02&email=ellenmiia&password=smile): failed to open stream: no suitable wrapper could be found
Error code: 2
-- Backtrace --
/home/.barrett/figs/do4jesus.org/net/plugins/flickr/pluginflickr.class.php(371): fopen
/home/.barrett/figs/do4jesus.org/net/plugins/flickr/pluginflickr.class.php(113): pluginflickr.cached_get_file_contents

-- del
已記錄
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #1 於: 八月 10, 2005, 03:06:30 下午 »

引用自: Figs

我的虛擬主機為dreamhost
Exception message: fopen(): URL file-access is disabled in the server


那是因為 dreamhost default 是把 fopen access url 的 function 關掉了!你必須把他打開!

你可能要參考 dreamhost 的相關 FAQ 文件。

Mark
已記錄

markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #2 於: 八月 10, 2005, 03:18:21 下午 »

引用自: markwu
引用自: Figs

我的虛擬主機為dreamhost
Exception message: fopen(): URL file-access is disabled in the server


那是因為 dreamhost default 是把 fopen access url 的 function 關掉了!你必須把他打開!

你可能要參考 dreamhost 的相關 FAQ 文件。

Mark


看樣子的確是 dreamhost 把 allow_url_fopen 關掉了! 請看:

http://wiki.dreamhost.com/index.php/Allow_url_fopen

mmm .... 有空再來改寫成其他方式吧!暫時你是無法在 dreamhost 使用 flickr plugin 了。

Mark
已記錄

Figs
新手見習
*
文章: 3



檢視個人資料 個人網站
« 回覆文章 #3 於: 八月 10, 2005, 03:31:19 下午 »

引用自: markwu
引用自: markwu
引用自: Figs

我的虛擬主機為dreamhost
Exception message: fopen(): URL file-access is disabled in the server


那是因為 dreamhost default 是把 fopen access url 的 function 關掉了!你必須把他打開!

你可能要參考 dreamhost 的相關 FAQ 文件。

Mark


看樣子的確是 dreamhost 把 allow_url_fopen 關掉了! 請看:

http://wiki.dreamhost.com/index.php/Allow_url_fopen

mmm .... 有空再來改寫成其他方式吧!暫時你是無法在 dreamhost 使用 flickr plugin 了。

Mark


謝謝你這麼快速的回覆
看樣子只能等待了
再次謝謝你
已記錄
Figs
新手見習
*
文章: 3



檢視個人資料 個人網站
« 回覆文章 #4 於: 八月 11, 2005, 01:29:41 下午 »

改pluginflickr.class.php裡下面的程式碼,從fopen改成curl

        $f = @fopen($file,"r"); // Open remote source file
              if (!$f) // Remote file couldn't be opened
              {
                 return @file_get_contents ($cache_filename); // Return the file contents from the cache
              }
              $f2 = @fopen($cache_filename,"w+"); // Open local cache file
              while ($r = @fread($f,8192)) // Loop through remote source file
              {
                 @fwrite($f2,$r); // Write to the local cache
              }
              @fclose($f2);
              @fclose($f);

改成curl後程式碼

                     $curl_handle = curl_init();

      if( !$curl_handle ) {
         return @file_get_contents ($cache_filename); // Return the file contents form the cache
      }

      curl_setopt ($curl_handle, CURLOPT_URL, $file);
      curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);

      $buffer = curl_exec($curl_handle);

      curl_close($curl_handle);

      $f2 = @fopen($cache_filename,"w+"); // Open local cache file

      fwrite($f2,$buffer); // Write to the local cache

      @fclose($f2);

就可以了
已記錄
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #5 於: 八月 11, 2005, 02:07:15 下午 »

呵呵!本來我昨天有想過用 curl (dreamhost 的建議),但是 curl 並非標準的 PHP 程式庫方式,所以這樣改還是有人無法執行。

不過改得很好!  吐舌頭 放入精華區中。

Mark
已記錄

頁: [1]
LifeType 中文開發論壇  |  開發  |  外掛程式  |  flickr的問題 « 上篇主題 下篇主題 »
    前往: