Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:04:28+00:00 2026-06-13T17:04:28+00:00

I have the below XML Structure below but I am unsure how I can

  • 0

I have the below XML Structure below but I am unsure how I can get direct access to the URL so that I can use it as a src in my image tag.

PHP Structure:

$images = $url->property->photos
<img src="'.$images.'" width="233" height="154" /> - Testing URL  

General XML Structure:

<photos>
 <photo>
  Information
 </photo>
</photos>

XML Structure:

["photos"]=>
    object(SimpleXMLElement)#118 (2) {
      ["@attributes"]=>
      array(1) {
        ["count"]=>
        string(2) "43"
      }
      ["photo"]=>
      array(43) {
        [0]=>
        string(97) "http://www.domain.co.nz/images/6f8bc4855bface1ad2c35635625fdbb4c3a11537.jpeg"
        [1]=>
        string(97) "http://www.domain.co.nz/images/fcb36e4a3465b934490d44e6bb8e1a8192cb466d.jpeg"
        [2]=>
        string(97) "http://www.domain.co.nz/images//c1e2c792832a08f881bb24756137a63a19c7070d.jpeg"
        [3]=>
        string(97) "http://www.domain.co.nz/images/b6d9a3c52c7fba81553edb9101c80d273c16ee3c.jpeg"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:04:30+00:00Added an answer on June 13, 2026 at 5:04 pm
    $xmlstr = <<<XML
    <properties count="1">
            <property approved="yesterday">
                    <address>123 Main Street</address>
                    <photos count="2">
                            <photo>1.jpg</photo>
                            <photo>2.jpg</photo>
                    </photos>
            </property>
    </properties>
    XML;
    $properties = new SimpleXMLElement($xmlstr);//this could have been done using simplexml_load_file($url); for instance
    //the important part is that you have a SimpleXML object named $properties
    foreach($properties->property as $property){
            echo $property['approved']."<br>\n";
            echo $property->address."<br>\n";
            foreach($property->photos->photo as $photo){
                    echo $photo."<br>\n";
            }
    }
    

    I assume you may have multiple properties and you want to list each one. If you only have one, or only want to list the first one, you can safely remove the first foreach loop:

    echo $properties->property[0]['approved']."<br>\n";
    echo $properties->property[0]->address."<br>\n";
    foreach($properties->property[0]->photos->photo as $photo){
        echo $photo."<br>\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to parse a 1Gb XML file with a structure such as below
I have two XML files. The structure of both XML files is as below:
I have an xml as below < Image>ImageValue1 <Type>png</Type> <Value>ImageValue1</ Value> </ Image> Here
I have an xml string below that I've turned into an object using $content
I have a standard code like below to validate xml against xsd, but it
I have a xml structure similar to below one: <test> <test1>test1 value</test1> </test> Now
I have the following simple XML structure that has to be parsed: <Nodes> <Node
I currently have an XML Structure that looks something like this <Parent> <Info> <Info-Data></Info-Data>
I have the below fragement of XML, notice that the Reference node holds a
I have a class that processes XML files. It works, but the problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.