Por ejemplo, Así funciona correctamente:
Código PHP:
$what = 'ResourceLink';
$reader = new XMLReader();
$reader->open('http://file.xml/getRecordsX.do?user=usuario&password=pass=978841580114-6&metadataformat=ONIX&version=3.0');
while ($reader->read()) {
if ($reader->nodeType == XMLReader::ELEMENT) {
$exp = $reader->expand();
if ($exp->nodeName == $what)
echo '<img src="' . $exp->nodeValue .' " height="15%" width="15%" />';
}
}
de este modo, no me muestra nada:
Código PHP:
$id = "978841580114-6";
$what = 'ResourceLink';
$reader = new XMLReader();
$reader->open('http://file.xml/getRecordsX.do?user=usuario&password=pass&identifier=$id&metadataformat=ONIX&version=3.0');
while ($reader->read()) {
if ($reader->nodeType == XMLReader::ELEMENT) {
$exp = $reader->expand();
if ($exp->nodeName == $what)
//echo '<img src="' . $exp->nodeValue .' " height="15%" width="15%" />';
$img = $exp->nodeValue;
print $img;
}
}
Hay alguna manera de asigna a una variable php el $exp->nodeValue?