ale mam wrażenie że są szybsze rozwiązania, prawda

czekam na Wasze propozycje
<?php /* Read XML structure to associative array -- Using: $xml = new XMLReader(); $xml->open([XML file]); $assoc = xml2assoc($xml); $xml->close(); */ function xml2assoc($xml) { $assoc = null; while($xml->read()){ switch ($xml->nodeType) { case XMLReader::END_ELEMENT: return $assoc; case XMLReader::ELEMENT: if($xml->hasAttributes){ while($xml->moveToNextAttribute()) $el['attributes'][$xml->name] = $xml->value; } break; case XMLReader::TEXT: case XMLReader::CDATA: $assoc .= $xml->value; } } return $assoc; } ?> ale nawet nie wiem gdzie mam wstawić plik xml który zakupilem, to adres pliku : <a href=\"http://www.timeandscore.com/xml/?username=\" target=\"_blank\">http://www.timeandscore.com/xml/?username=</a>[...user...]&password=[...pass...]
<?php // Twoj plik xml $plikXML = ''; $xml = new XMLReader(); $xml->open($plikXML); $assoc = xml2assoc($xml); $xml->close(); ?>
<?php $reader = new XMLReader(); $reader->open('jakis_plik.xml'); $count=0; while($reader->read()) { if($reader->nodeType == XMLReader::ELEMENT) { $name = $reader->name; if ($reader->name == 'offer') { } } if($reader->nodeType == XMLReader::TEXT || $reader->nodeType == XMLReader::CDATA) { } if($reader->nodeType == XMLReader::END_ELEMENT) { if ($reader->name == 'offer') { $count++; } } } // Tutaj wyswietlam otrzymana tablicę ?>
<?xml version="1.0" encoding="ISO-8859-2"?> <!DOCTYPE nokaut SYSTEM "http://www.nokaut.pl/integracja/nokaut.dtd"> <nokaut> <offers> <offer> <id>1</id> <name>Nazwa czegos</name> <description>Jakis opis</description> </offer> <offer> <id>2</id> <name>Nazwa czegos 2</name> <description>Jakis opis 2</description> </offer> </offers> </nokaut>