I am reading in a text file and from it I am creating an xml feed that I will be pulling into flash. The text file contains some html tags that is appearing in the xml feed. I need to strip the html tags out for flash.
My code is below but the replace function does not seem to be working.
Any ideas ?
Many Thanks
Rowan
<?php
include("vars.php");
$fp=fopen($textfile1,'r');
$FileContents=fread($fp, filesize ($textfile1));
fclose($fp);
$fp=fopen($xml_output_dir.$xml_output1,'w');
fclose($fp);
$FileData= explode("", $FileContents);
$output.= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
$output.= "<properties>\n";
for($i=0;$i<count($FileData);$i++)
{
$Data = explode("|", $FileData[$i]);
for($c=0;$c<26;$c++)
{
$Hold[$c]=trim($Data[$c]);
$Result[$c]=eregi_replace(" ", "" , $Hold[$c]); echo $Result[$c];
$Result[$c]=eregi_replace("<b>", "" , $Hold[$c]);
$Result[$c]=eregi_replace("</b>", "" , $Hold[$c]);
$Result[$c]=eregi_replace("<u>", "" , $Hold[$c]);
$Result[$c]=eregi_replace("</u>", "" , $Hold[$c]);
$Result[$c]=eregi_replace("<i>", "" , $Hold[$c]);
$Result[$c]=eregi_replace("</i>", "" , $Hold[$c]);
$Result[$c]=eregi_replace("\r\n", "" , $Hold[$c]); }
if ($Result[13]=='BU')
{$pt="Bungalow";}
if ($Result[13]=='FL')
{$pt="Flat";}
if ($Result[13]=='TH')
{$pt="Townhouse";}
if ($Result[13]=='SD')
{$pt="Semi-detached";}
if ($Result[13]=='DE')
{$pt="Detached";}
if ($Result[13]=='TE')
{$pt="Terrace";}
if ($Result[13]=='OT')
{$pt="Other";}
$main_image=$Result[9].".jpg";
$find='*'; // delimeter character in the bullet point field
$part = substr($Result[12], 1); // strip off the first character from the string
for($a=0;$a<9;$a++)
{
$pos = strpos($part,$find); // find first occurence of the delimeter character
$b[$a] = substr($part, 0, $pos); // read up to the first delimeter character and store in a variable
$part=substr($part,$pos);
$part=substr($part,1);
$b[$a]=trim($b[$a]);
}
//Standard Team xml Output
$output.= " <property>\n";
$output.= " <property_ref>{$Result[9]}</property_ref>\n";
$output.= " <location>{$Result[2]}</location>\n";
$output.= " <description>{$Result[8]}</description>\n";
$output.= " <price>{$Result[5]}</price>\n";
$output.= " <main_image>{$main_image}</main_image>\n";
$output.= " <bullet1>{$b[0]}</bullet1>\n";
$output.= " <bullet2>{$b[1]}</bullet2>\n";
$output.= " <bullet3>{$b[2]}</bullet3>\n";
$output.= " <bullet4>{$b[3]}</bullet4>\n";
$output.= " <bullet5>{$b[4]}</bullet5>\n";
$output.= " <bullet6>{$b[5]}</bullet6>\n";
$output.= " <bullet7>{$b[6]}</bullet7>\n";
$output.= " <bullet8>{$b[7]}</bullet8>\n";
$output.= " <property_type>{$pt}</property_type>\n";
$output.= " <status></status>\n";
$output.= " <bedrooms>{$Result[6]}</bedrooms>\n";
$output.= " <bathrooms>{$Result[7]}</bathrooms>\n";
$output.= " <post_code></post_code>\n";
$output.= " <area></area>\n";
$output.= " <tenure></tenure>\n";
$output.= " <internal1>{$Result[14]}</internal1>\n";
$output.= " <internal2>{$Result[15]}</internal2>\n";
$output.= " <internal3>{$Result[16]}</internal3>\n";
$output.= " <internal4>{$Result[17]}</internal4>\n";
$output.= " <virtualTour>{$Result[25]}</virtualTour>\n";
$output.= " <floorPlan1></floorPlan1>\n";
$output.= " <floorPlan2></floorPlan2>\n";
$output.= " </property>\n";
}
$output.= "</properties>\n";
$fp=fopen($xml_output_dir.$xml_output1,'w');
fwrite($fp,$output);
fclose($fp);
{}
?>