Hello,
I have finally got my php script working so that it will read in a pipe delimited file and display the xml. What I want to do though is instead of displaying it ont the screen to write it away into a file called pl.xml instead. Anyone can help ?
I have attached the code....
<?php
include("vars.php");
$fp=fopen($textfile,'r');
$FileContents=fread($fp, filesize ($textfile));
fclose($fp);
$FileData= explode("", $FileContents);
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
echo "<properties>\n";
for($i=0;$i<count($FileData);$i++)
{
$Data = explode("¦", $FileData[$i]);
for($c=0;$c<10;$c++)
{$Result[$c]=trim($Data[$c]); }
$c=0;
$image=$Result[3];
$conv_image=eregi_replace(",", " " , $image);
$len=strpos($conv_image," ");
$Result[3]=substr($conv_image,0,$len);
echo " <property>\n";
echo " <property_ref>{$Result[0]}</property_ref>\n";
echo " <location>{$Result[1]}</location>\n";
echo " <price>{$Result[2]}</price>\n";
echo " <main_image>{$Result[3]}</main_image>\n";
echo " <bullet1>{$Result[4]}</bullet1>\n";
echo " <bullet2>{$Result[5]}</bullet2>\n";
echo " <bullet3>{$Result[6]}</bullet3>\n";
echo " <bullet4>{$Result[7]}</bullet4>\n";
echo " <bullet5>{$Result[8]}</bullet5>\n";
echo " <bullet6>{$Result[9]}</bullet6>\n";
echo " <bullet7>{$Result[10]}</bullet7>\n";
echo " <bullet8>{$Result[11]}</bullet8>\n";
echo " </property>\n";
}
echo "</properties>\n";
?>