user2819330
user2819330

Reputation:

Simple XML is not displaying my url tag data

I managed to clean my xml but when I display the data all tags show but the tag with a URLTempImageURL does not display the url when I echo.

My xml

<?xml version="1.0" encoding="utf-8"?>
<lists>
    <Property>
        <Reference>123123</Reference>
        <Images>
             <TempImageURL>https://x.ctrl.com/Image.ashx?Id=e1f47a89-c289-43e1-a2c2-0d35196a97ee&amp;userId=7414</TempImageURL>
        </Images>
    </Property>
</lists>

My php

$xml_source='simple_prop2.xml';


$xml=simplexml_load_file($xml_source);

foreach ($xml->Property as $prop){
    echo $prop->Reference.' '.$prop->Images->TempImageURL.'<br>';
}

Upvotes: 1

Views: 450

Answers (2)

user2819330
user2819330

Reputation:

$xml_source='simple_prop2.xml';
$xml=simplexml_load_file($xml_source);

foreach($xml->Property as $prop){
    echo $prop->Reference.'<br>';
    foreach($xml->Property->Images as $chk)
   {
    echo $chk->TempImageURL.'<br>';
   }
}

Upvotes: 1

Praveen D
Praveen D

Reputation: 2377

Error in your code "failed to open stream" Add path with file name.

for example

$xml_source='http://localhost/test/simple_prop2.xml';

Upvotes: 0

Related Questions