is the first time that I parse an XML from PHP and I have many doubts.
I have written this code but it gives me some warning that I do not know if they are normal:
$url = "http://...xml_obras.php";
if(!$xml = simplexml_load_string($url))
{
echo "No se ha podido cargar el archivo";
}
else
{
echo "El archivo se ha cargado correctamente";
}
and in the url if I give to see source code I get this:
<obra>
<ninventario>197</ninventario>
<titulo>Blanca</titulo>
<autor>ALBERS</autor>
<fecha>1947</fecha>
</obra>
<obra>
<ninventario>198</ninventario>
<titulo>Alfa</titulo>
<autor>Jose</autor>
<fecha>1954</fecha>
</obra>
and without giving source code:
197 Blanca ALBERS 1947 198 Alfa Jose 1954
These are the warning:
SCREAM: Error suppression ignored for ( ! ) Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in
D: \ wamp \ www \ uploadXML.php on line 4
SCREAM: Error suppression ignored for ( ! ) Warning: simplexml_load_string(): http://.../xml_obras.php in D:\wamp\www\cargaXML.php on line 4
What am I doing wrong? Can you tell me how I have to do the foreach for the insert? Thank you very much