Ok here is the problem...
There is a function called ShowAmazon() that grabs some content from Amazon through their provided XML. There is no problem with this function and it works just fine.
You can see some test output of it at http://www.key2marketing.com/amazon/amazonsearch.php?com=show . As you can see, it does its job.
Now I would like to put this output into a file instead of screen. I created this function:
function file_put_body ($filename, $file_body) {
$tempname = tempnam($file_path, $filename);
$handle = fopen($tempname, 'wb');
fwrite($handle, $file_body);
fclose($handle);
unlink ($filename);
rename($tempname, $filename);
chmod ($filename, 0777);
return $file_body;
}
It may seem a little strange but it works, I've used it before with no problem.
Then let's put the output to a file...
$file = 'replace.html';
file_put_body ($file, ShowAmazon());
But this results in empty output which is then written to $file. I am obviously doing something very wrong but can't figure out how to make it put there the right content.
Any help is very welcome.
Thanks!
Tomas