Im aşağıdaki xml besleme bazı değerleri almak için çalışıyor
<?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>
Ben değerleri kapmak için aşağıdaki kodu kullanmış
<?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 />";
}
?>
Sorun i xml 3 kayıtları olmasına rağmen sadece ilk sonuçları gösteriyor olmasıdır. ve başında da altında hata verir. Bazı biri bana yardım edebilir misiniz
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
Herhangi bir yardım çok takdir edilecektir
teşekkürler