PHP error problem

I a have a web page in PHP that reads an xml file and write it to a file then it should insert the content of the xml file in a mysql table. The file is hosted on a remote site by a server provider. My page would not render and is throwing the following error message:

Fatal error: Call to undefined function readString() on line 82

I have the following in line 82

if (!isset($product[$name])
)

$product[$name] = $xmlReader>readString()
;

I m running PHP 5.2.5 with ISAPI extensions enabled on the web server

any idea where the problem is. The code is correct and does nt have any syntax error

Thanks

You missed “-”. Should be:
$product[$name] = $xmlReader->readString()

My host changed the PHP version from 5 to to PHP V 4.4.7 with CGI mode, and the error was removed but now I get a different error at different line,

Fatal error: Call to undefined function: file_put_contents() in D:\inetpub\vhosts\discountedtravels.co.uk\httpdocs\php\ estxml.php on line 26

This is line 26: file_put_contents($filename, $file)

file_put_contents is a PHP5 function only. You would need to revert back to using fopen, fwrite et al.

Why did your hosts revert BACK to an earlier PHP version? That is just bizarre!

Crazy, this is from the docs.


if (!function_exists('file_put_contents')) {
    function file_put_contents($filename, $data) {
        $f = @fopen($filename, 'w');
        if (!$f) {
            return false;
        } else {
            $bytes = fwrite($f, $data);
            fclose($f);
            return $bytes;
        }
    }
}

Thanks guy. They reverted it because I was getting a different error under version 5 as shown below:

Fatal error: Call to undefined function readString() in D:\inetpub\vhosts\discountedtravels.co.uk\httpdocs\php\ estxml.php on line 91
Error in my_thread_global_end(): 1 threads didn’t exit

Its frustrating that version fixed one problem and version 5 creates another one??