E
E
Evgeny Pilipenko2017-08-26 13:41:58
PHP
Evgeny Pilipenko, 2017-08-26 13:41:58

How to pull data from xml file?

Hello. Need to stick out a few lines from the XML file.
7d3eef126e454f0db42180da46c31c61.png
To solve this problem, I found such a script.
8c7eaf8b7c4548ab864aa6d20a66f1bc.png
But it shows only one line of the solution
3ba0b6127e314f8f8196cff4cadcc445.png
, and I need several options, or rather everything.
I realized that the number in the PHP file is responsible for the output result. How can I put a range or output everything in a file?
If there are other possibilities of output, then please go to the studio)).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Levunin, 2017-08-26
@klevunin

There is also this thing.
php.net/manual/en/book.xmlreader.php
Something like this

$reader = new XMLReader();
$reader->open($filexml);
while ($reader->read()) {
    switch ($reader->nodeType) {
        case (XMLREADER::ELEMENT):
            if ($reader->name == "offer" && $reader->nodeType == XMLReader::ELEMENT) {
                $doc = new DOMDocument('1.0', 'UTF-8');
                $xml = simplexml_import_dom($doc->importNode($reader->expand(), true));
        
        print $xml->picture;
      }
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question