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

  • SEARCH
  • Home
  • 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 559255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:13:09+00:00 2026-05-13T12:13:09+00:00

Im trying to get some values from the below xml feed <?xml version=1.0 ?>

  • 0

Im trying to get some values from the below xml feed

    <?xml version="1.0" ?>
<SEARCH>
  <LOCATION>
   <NAME>Terrance</NAME>
   <COUNTRY>USA</COUNTRY>
  </LOCATION>
<FOUND>
    <TOTALOFOUND>
    <TOTAL>3</TOTAL>
    </TOTALOFOUND>
  <PLACE>
      <ADDRESS>IL Road</ADDRESS>
      <NAME>shop1</NAME>
      <POSTCODE>5</POSTCODE>
    <CATIM>
      <SMALL>ILR.jpg</SMALL>
      <MEDIUM>ILR1.jpg</MEDIUM>
      <DESCRIPTION>feeds</DESCRIPTION>
    </CATIM>
    <BUILD>this is the first test xml feed</BUILD>
    <ID>1235</ID>
    <DIST>
     <LAT>25</LAT>
     <LONG>547</LONG>
   </DIST>
  </PLACE>
  <PLACE>
      <ADDRESS>Peter Road</ADDRESS>
      <NAME>textas</NAME>
      <POSTCODE>987</POSTCODE>
    <CATIM>
      <SMALL>test.jpg</SMALL>
      <MEDIUM>test1.jpg</MEDIUM>
      <DESCRIPTION>feeds new</DESCRIPTION>
    </CATIM>
    <BUILD>this is the second test xml feed</BUILD>
    <ID>1235</ID>
    <DIST>
     <LAT>25</LAT>
     <LONG>547</LONG>
   </DIST>
  </PLACE>
   <PLACE>
      <ADDRESS>Thsi is the 3rd st</ADDRESS>
      <NAME>utah</NAME>
      <POSTCODE>9117</POSTCODE>
    <CATIM>
      <SMALL>utah.jpg</SMALL>
      <MEDIUM>utah1.jpg</MEDIUM>
      <DESCRIPTION>feeds new 3</DESCRIPTION>
    </CATIM>
    <BUILD>this is the third test xml feed</BUILD>
    <ID>000000</ID>
    <DIST>
     <LAT>000</LAT>
     <LONG>54000</LONG>
   </DIST>
  </PLACE>
 </FOUND>
</SEARCH>

I have used the following code to grab the values

<?php
strings = file_get_contents("feed.xml");
$xml=simplexml_load_string($strings);

foreach ($xml as $place)
{
echo "Total : ".$place->TOTALOFOUND->TOTAL."<br />";
echo "address: ".$place->PLACE->ADDRESS."<br />";
echo "Name : ".$place->PLACE->NAME."<br />";
echo "post code: ".$place->PLACE->POSTCODE."<br />";
echo "Small image: ".$place->PLACE->CATIM->SMALL."<br />";
echo "Medium Image: ".$place->PLACE->CATIM->MEDIUM."<br />";
echo "Descripton: ".$place->PLACE->CATIM->DESCRIPTION."<br />";
echo "Office ID: ".$place->PLACE->ID."<br />";
echo "Cord Lat: ".$place->PLACE->DIST->LAT."<br />";
echo "Cord Long: ".$place->PLACE->DIST->LONG."<br />"."<br />";
}
?>

the problem is that although i have 3 records in the xml it shows only the first results. and at the beginning it gives the below error. Can some one please help me

Total :
address:
Name :
post code:

Notice: Trying to get property of non-object in C:\wamp\www\site\test.php on line 16
Small image:

Notice: Trying to get property of non-object in C:\wamp\www\site\test.php on line 17
Medium Image:
Descripton:
Office ID:

Notice: Trying to get property of non-object in C:\wamp\www\site\test.php on line 20
Cord Lat:

Notice: Trying to get property of non-object in C:\wamp\www\site\test.php on line 21
Cord Long:

Total : 3
address: IL Road
Name : shop1
post code: 5
Small image: ILR.jpg
Medium Image: ILR1.jpg
Descripton:
Office ID: 1235
Cord Lat: 25
Cord Long: 547

any help will be much appreciated

thanks

  • 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-05-13T12:13:09+00:00Added an answer on May 13, 2026 at 12:13 pm

    You have to look at the structure of the XML more closely and access the nodes in the appropriate way base on their hierarchy.

    echo "Total : ".$xml->FOUND->TOTALOFOUND->TOTAL."<br />";
    foreach ( $xml->FOUND->PLACE as $place )
    {
      echo "address: ".$place->ADDRESS."<br />";
      echo "Name : ".$place->NAME."<br />";
      echo "post code: ".$place->POSTCODE."<br />";
      echo "Small image: ".$place->CATIM->SMALL."<br />";
      echo "Medium Image: ".$place->CATIM->MEDIUM."<br />";
      echo "Descripton: ".$place->CATIM->DESCRIPTION."<br />";
      echo "Office ID: ".$place->ID."<br />";
      echo "Cord Lat: ".$place->DIST->LAT."<br />";
      echo "Cord Long: ".$place->DIST->LONG."<br />"."<br />";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some XML data with LINQ, but running into a
I am trying to get some xpath from xsl variable using xsl ver 1.0
I am trying to get some accurate runtime comparisons of PHP vs Python (and
Hi I'm trying to get some practice with Linked Lists. I Defined an Object
I'm trying to get some code working that a previous developer has written. Yep,
I am trying to get some JavaScript to programmatically adjust a HTML img tag's
I'm trying to get some ideas about how to develop a web login screen.
Ok, so I'm trying to get some UDP code working and I'm barely green
Im trying to get into some basic JavaFX game development and I'm getting confused
I'm trying to get the label of some network resources mapped as drives. When

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.