Hi I want to parse in php
and read only one option of each line. How can I do this?
I tried:
<?php
$xml = file_get_contents("file.xml");
echo $xml;
?>
But this read the full xml. I need only one option of the xml
Hi I want to parse in php
and read only one option of each line. How can I do this?
I tried:
<?php
$xml = file_get_contents("file.xml");
echo $xml;
?>
But this read the full xml. I need only one option of the xml
Try this
<? php $xml = simplexml_load_file("path/to/your/file/file.xml"); ?>
Convert your object into array like this
$array= (array) $xml;
after that you can do this
$option = $array['OptionName'];
Take a look at simplexml_load_file and turn your xml into a workable object where you can loop through and find whichever properties you need.
$xml = simplexml_load_file('file.xml');
foreach($xml->ParkingData as $k => $v)
echo $v->ParkingFacility->ParkingName ." - Vacant Spaces: ". $v->ParkingFacility->VacantSpaces."<br />";