So I've tried 6 different methods of pulling the data from the xml but each time I get nothing. I KNOW it's going to be something stupidly simple, but at the moment I'm stumpped. Here is the code I'm working with, and not that it's not complete as I still need to write in the glob code to limit the results to a single date. Edit: the print is commented because I used it to show me that the xml is reading.
$date = date("Y-m-d");
//echo $fdate;
$glob = "./fromdb/TimesheetBackup_" . $date. "*.xml";
foreach (glob ($glob) as $result) {
echo $result;
$xml = simplexml_load_file($result);
$count = 0;
//print_r($xml);// "<br> $xml";
foreach ($xml->tasks[] as $tasks):
$starttimeb = $tasks['startDate'];
$starttime = substr($starttimeb, -8, -1);
$endtime = $tasks->key->endDate;
echo $starttime;
echo "<br> $endtime";
endforeach;
}
and a sample of the xml (end of a 48 record xml)
<task>
<taskId>f620bba390874d9fa41ddc4384ac0ba0</taskId>
<projectId>7ab307cc59e84219b5e1b7b6215a7400</projectId>
<description></description>
<location>552 Pandora Ave, Victoria, BC V8W 1N7</location>
<startDate>2014-01-02T13:15:00</startDate>
<endDate>2014-01-02T16:33:00</endDate>
<deleted>false</deleted>
<endTime>0</endTime>
<startTime>0</startTime>
<lastUpdate>1388709184182</lastUpdate>
<paid>0</paid>
<feeling>0</feeling>
</task>
</tasks>
</timesheet>
I'm trying to get this to work with a xml that's created by the android app Timesheet. This is from it's auto backup system so I have no control over the output of the xml.