Hi Site pointers,
I am try to parse an XML file.
http://www.xml2u.com/Xml/Property%20Salespana_735/1335_Default.xml
The XML describes properties for sale. I am not sure how to access the images:
Any help will be greatly appreciated.
My code below successfully extracts the property details, but not the images.
//property Sales Espana
$xml_link = "http://www.xml2u.com/Xml/Property%20Salespana_735/1335_Default.xml";
//echo $xml_link;
$xml = simplexml_load_file($xml_link);
// get agent id
foreach ($xml->Clients->Client->properties->Property as $Property) {
$propertyid = $Property->propertyid;
$location = $Property->Address->location;
$street = $Property->Address->street;
$region = $Property->Address->region;
$country = $Property->Address->country;
$currency = $Property->Price->currency;
$price = $Property->Price->price;
$status = $Property->Price->status;
$propertyType = $Property->Description->propertyType;
$bedrooms = $Property->Description->bedrooms;
$fullBathrooms = $Property->Description->fullBathrooms;
$title = $Property->Description->title;
$description = $Property->Description->description;
$floorSize = $Property->Description->FloorSize->floorSize;
$floorSizeUnits = $Property->Description->FloorSize->floorSizeUnits;
$plotSize = $Property->Description->PlotSize->plotSize;
$plotSizeUnits = $Property->Description->PlotSize->plotSizeUnits;
$Feature1 = $Property->Description->Features->Feature1;
$Feature2 = $Property->Description->Features->Feature2;
$Feature3 = $Property->Description->Features->Feature3;
$Feature4 = $Property->Description->Features->Feature4;
$link = $Property->link->dataSource;
foreach($Property->images as $images) {
$image = $images-> image;
}
//$plotSizeUnits= $Features->PlotSize->plotSizeUnits;
$output = $output.$propertyid.'<br />'.
$location.'<br />'.
$street.'<br />'.
$region.'<br />'.
$currency.'<br />'.
$price.'<br />'.
$status.'<br />'.
$propertyType.'<br />'.
$bedrooms .'<br />'.
$fullBathrooms.'<br />'.
$title.'<br />'.
$description.'<br />'.
$floorSize.'<br />'.
$floorSizeUnits.'<br />'.
$plotSize.'<br />'.
$plotSizeUnits.'<br />'.
$Feature1 .'<br />'.
$Feature2.'<br />'.
$Feature3.'<br />'.
$Feature4.'<br />'.
$link.'<br />'.
$image.'<br />'
;
}