I am new in xml and data retrieve and i have problem with this code.
XML code:
<?xml version="1.0" encoding="UTF-8"?>
<site>
<page>
<content>
<P>
<FONT size="2" face="Tahoma">
<STRONG>text...</STRONG>
</FONT>
</P>
<P>
<FONT size="2" face="Tahoma">text....</FONT>
</P>
<P align="center">
<IMG style="WIDTH: 530px" border="1" alt="" src="http://www.alkul.com/online/2014/5/6/child%20disorder.jpg">
</P>
<P>
<STRONG>
<FONT size="2" face="Tahoma">text3</FONT>
</STRONG>
</P>
<P>
<STRONG>
<FONT size="2" face="Tahoma">text1</FONT>
</STRONG>
</P>
</content>
</page>
</site>
php code:
<?php
$html = "";
$url = "Data.xml";
$xml = simplexml_load_file($url);
for ($i = 0; $i<10; $i++) {
$title = $xml->page[$i]->content->P->FONT;
$html .= "<p>$title</p>";
}
echo $html;
I just need to display the content of content node but the output is empty