View Single Post
  #62  
Old 02-10-2005, 11:06 AM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

Quote:
Originally Posted by cybrgman
Just an FYI

Doesn't work with PHP 4.2.2
Fatal error: Call to undefined function: file_get_contents()

I had such high hopes

I am suprised anyone is still using PHP 4.2.2. I would recommend upgrading to 4.3.10 if possible, if not...your solution is below.

Add the following to a file named "file_get_contents.php" and put it in the same directory as the catalog cleaning script.
Code:
<?php // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Aidan Lister <aidan@php.net> | // +----------------------------------------------------------------------+ // // $Id: file_get_contents.php,v 1.20 2004/11/14 16:10:50 aidan Exp $ /** * Replace file_get_contents() * * @category PHP * @package PHP_Compat * @link http://php.net/function.file_get_contents * @author Aidan Lister <aidan@php.net> * @version $Revision: 1.20 $ * @internal resource_context is not supported * @since PHP 5 * @require PHP 4.0.1 (trigger_error) */ if (!function_exists('file_get_contents')) { function file_get_contents($filename, $incpath = false, $resource_context = null) { if (false === $fh = fopen($filename, 'rb', $incpath)) { trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING); return false; } clearstatcache(); if ($fsize = @filesize($filename)) { $data = fread($fh, $fsize); } else { $data = ''; while (!feof($fh)) { $data .= fread($fh, 8192); } } fclose($fh); return $data; } } ?>

Then add the following after the "register_shutdown_function" line:
Code:
require('file_get_contents.php');

This has been pulled from the PEAR package PHP_Compat.

And for anyone who is wondering, I am still working on version 2.0 of this script. Won't have the same title and cleaning the HTML catalog will be only a minor function compared to the overall feature pack I am adding to it. However, because this is taking so much work it could be one to two months down the line.
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote