歡迎光臨, 訪客. 請先 登入註冊一個帳號.
五月 02, 2024, 02:07:01 上午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
  列出文章
頁: [1]
1  開發 / 外掛程式 / flickr的問題 於: 八月 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);

就可以了
2  開發 / 外掛程式 / Re: flickr的問題 於: 八月 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


謝謝你這麼快速的回覆
看樣子只能等待了
再次謝謝你
3  開發 / 外掛程式 / flickr的問題 於: 八月 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
頁: [1]