Index: /extensions/piwigopress/PiwigoPress_code.php
===================================================================
--- /extensions/piwigopress/PiwigoPress_code.php	(revision 4124)
+++ /extensions/piwigopress/PiwigoPress_code.php	(revision 4125)
@@ -1,5 +1,5 @@
 <?php
-if (defined('PHPWG_ROOT_PATH')) return; /* Avoid Automatic install under Piwigo */
-if (!defined('PWGP_NAME')) return; /* Avoid Direct call */
+if (defined('PHPWG_ROOT_PATH')) return; /* Avoid direct usage under Piwigo */
+if (!defined('PWGP_NAME')) return; /* Avoid unpredicted access */
 
 global $wpdb; /* Need for recent thumbnail access */
@@ -39,8 +39,9 @@
 echo $before_widget;
 echo $title;
+if (!function_exists('pwg_get_contents')) include 'PiwigoPress_get.php';
 
 if ($thumbnail == 'true') {
 	// Make the Piwigo link
-	$response = file_get_contents( $piwigo_url 
+	$response = pwg_get_contents( $piwigo_url 
 			. 'ws.php?method=pwg.categories.getImages&format=php'
 			. $options . '&recursive=true&order=random&f_with_thumbnail=true');
@@ -58,5 +59,5 @@
 if ($mbcategories == 'true') {
 	// Make the Piwigo category list
-	$response = file_get_contents( $piwigo_url 
+	$response = pwg_get_contents( $piwigo_url 
 			. 'ws.php?method=pwg.categories.getList&format=php&public=true');
 	$cats = unserialize($response);
Index: /extensions/piwigopress/PiwigoPress_get.php
===================================================================
--- /extensions/piwigopress/PiwigoPress_get.php	(revision 4125)
+++ /extensions/piwigopress/PiwigoPress_get.php	(revision 4125)
@@ -0,0 +1,88 @@
+<?php
+if (defined('PHPWG_ROOT_PATH')) return; /* Avoid direct usage under Piwigo */
+if (!defined('PWGP_NAME')) return; /* Avoid unpredicted access */
+//error_reporting(E_ALL);
+if (!isset($pwg_mode)) $pwg_mode = ''; // Remind which process is working well
+$pwg_prev_host = ''; // Remind last requested gallery 
+
+function pwg_get_contents($url, $mode='') {
+
+	global $pwg_mode, $pwg_prev_host;
+	$timeout = 5; // will be a parameter (only for the socket)
+
+	$host = (strtolower(substr($url,0,7)) == 'http://') ? substr($url,7) : $url;
+	$host = (strtolower(substr($host,0,8)) == 'https://') ? substr($host,8) : $host;
+	$doc = substr($host, strpos($host, '/'));
+	$host = substr($host, 0, strpos($host, '/'));
+
+	if ($pwg_prev_host != $host) $pwg_mode = ''; // What was possible with one website could be different with another
+	$pwg_prev_host = $host;
+	$mode = $pwg_mode;
+	//$mode = 'ch'; // Forcing a test '' all, 'fs' fsockopen, 'ch' cURL
+
+// 1 - The simplest solution: file_get_contents
+// Contraint: php.ini
+//      ; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
+//      allow_url_fopen = On
+	if ( $mode == '' ) {
+	  if ( true === (bool) ini_get('allow_url_fopen') ) { 
+			$value = file_get_contents($url);
+			if ( $value !== false) {
+				return $value;
+			}
+		}
+	}
+	if ( $mode == '' ) $mode = 'fs';
+	if ( $pwg_mode == '' ) $pwg_mode = 'fs';
+// 2 - Often accepted access: fsockopen
+	if ($mode == 'fs') {
+		$fs = fsockopen($host, 80, $errno, $errstr, $timeout);
+		if ( $fs !== false ) {
+			fwrite($fs, 'GET ' . $doc . " HTTP/1.1\r\n");
+			fwrite($fs, 'Host: ' . $host . "\r\n");
+			fwrite($fs, "Connection: Close\r\n\r\n");
+			stream_set_blocking($fs, TRUE);
+			stream_set_timeout($fs,$timeout); // Again the $timeout on the get
+			$info = stream_get_meta_data($fs);
+			$value = '';
+			while ((!feof($fs)) && (!$info['timed_out'])) {
+							$value .= fgets($fs, 4096);
+							$info = stream_get_meta_data($fs);
+							flush();
+			}
+			$value = substr($value, strpos($value,'a:2:{s:4:"stat";'));
+			// echo '<br/>-fs- ('. $value . ') <br/>';
+			if ( $info['timed_out'] === false ) return $value;
+		}
+	}
+	$return["stat"] = 'failed';
+	$pwg_mode = 'failed';
+	return serialize($return);
+
+// Not active cURL right now
+	if ( $pwg_mode == 'fs' ) $pwg_mode = 'ch';
+// 3 - Sometime another solution: curl_exec
+// See http://fr2.php.net/manual/en/curl.installation.php
+  if (function_exists('curl_init') and $pwg_mode == 'ch') {
+		$ch = @curl_init();
+		@curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
+		@curl_setopt($ch, CURLOPT_URL, $url);
+		@curl_setopt($ch, CURLOPT_HEADER, 1);
+		@curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
+		@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+		@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+		$value = @curl_exec($ch);
+		$header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+		$status = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
+		@curl_close($value);
+		if ($value !== false and $status >= 200 and $status < 400)
+				$value = substr($value, $header_length);
+	}
+
+	// No other solutions
+	$return["stat"] = 'failed';
+	echo '<br/>- pwg_get_contents: failed on file_get, fsockopen and cURL processes<br/>';
+	$pwg_mode = 'failed';
+	return serialize($return);
+}
+?>
Index: /extensions/piwigopress/PiwigoPress_options.php
===================================================================
--- /extensions/piwigopress/PiwigoPress_options.php	(revision 4124)
+++ /extensions/piwigopress/PiwigoPress_options.php	(revision 4125)
@@ -1,5 +1,5 @@
 <?php
-if (defined('PHPWG_ROOT_PATH')) return; /* Avoid Automatic install under Piwigo */
-if (!defined('PWGP_NAME')) return; /* Avoid Direct call */
+if (defined('PHPWG_ROOT_PATH')) return; /* Avoid direct usage under Piwigo */
+if (!defined('PWGP_NAME')) return; /* Avoid unpredicted access */
 
 	// Defaults
Index: tensions/piwigopress/index.php
===================================================================
--- /extensions/piwigopress/index.php	(revision 4124)
+++ 	(revision )
@@ -1,33 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | PhpWebGallery - a PHP based picture gallery                           |
-// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// +-----------------------------------------------------------------------+
-// | file          : $Id$
-// | last update   : $Date$
-// | last modifier : $Author$
-// | revision      : $Revision$
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
-$url = '../';
-header( 'Request-URI: '.$url );
-header( 'Content-Location: '.$url );
-header( 'Location: '.$url );
-exit();
-?>
Index: tensions/piwigopress/main.inc.php
===================================================================
--- /extensions/piwigopress/main.inc.php	(revision 4124)
+++ 	(revision )
@@ -1,11 +1,0 @@
-<?php
-/*
-Plugin Name: PiwigoPress
-Plugin URI: http://piwigo.org/ext/extension_view.php?eid=316
-Description: PiwigoPress is a WordPress 2.8 widget, it links a public picture in your Piwigo gallery (<a href="http://piwigo.org/">Piwigo</a>). In other words, it's a WordPress Sidebar Widget with some available public pictures in your Piwigo gallery as a prereq.
-Version: auto
-Authors: VDigital, rvelices, Laurent Duretz, ddtddt, rio (and indirectly P@t and plg)
-Author URI: http://www.vdigital.org/sharing/
-*/
-if (defined('PHPWG_ROOT_PATH')) return; /* Avoid Automatic install under Piwigo */
-?>
Index: /extensions/piwigopress/piwigopress.php
===================================================================
--- /extensions/piwigopress/piwigopress.php	(revision 4124)
+++ /extensions/piwigopress/piwigopress.php	(revision 4125)
@@ -4,5 +4,5 @@
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=316
 Description: PiwigoPress is a WordPress 2.8 widget, it links a public picture in your Piwigo gallery (<a href="http://piwigo.org/">Piwigo</a>). In other words, it's a WordPress Sidebar Widget with some available public pictures in your Piwigo gallery as a prereq.
-Version: 1.03
+Version: 1.04
 Author: vpiwigo ( for The Piwigo Team )
 Author URI: http://www.vdigital.org/sharing/
Index: /extensions/piwigopress/readme.txt
===================================================================
--- /extensions/piwigopress/readme.txt	(revision 4124)
+++ /extensions/piwigopress/readme.txt	(revision 4125)
@@ -73,4 +73,8 @@
 == Changelog ==
 
+= 1.04 = 
+* Alternate pwg_get_contents (file_get_contents, fsockopen, ...)
+* cURL is coming
+
 = 1.03 = 
 * Project rename: Directory name changed for WordPress constraints
