Answer the question
In order to leave comments, you need to log in
How does XMLReader work in PHP?
Please explain the features of the Read method.
Let's say there is a code
$xmlUrl = file_get_contents('feed.xml');
$xmlReader = new XMLReader();
$xmlReader->xml($xmlUrl);
while ($xmlReader->read()) {
if ($xmlReader->name === 'offer') {
var_dump ($xmlReader->getAttribute('internal-id'));
$xmlReader->next();
}
}
$xmlReader->close();
<offer internal-id="1">
</offer>
<offer internal-id="2">
</offer>
<offer internal-id="3">
</offer>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question