i am having this code that is used for parsing a xml url and stores output in the $query variable.
$url = 'http://www.slideshare.net/api/2/search_slideshows?api_key=GRCsS0fPo&
ts=1320547556&hash=cf362f863d1f15e84c7a520804f7826731f958c4&q=electrical+engineering&
page=4&download=0&items_per_page=25';
echo $url;
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Your application name');
$query = curl_exec($ch);
curl_close($ch);
$array = (array) simplexml_load_string($query);
echo '<pre>';
print_r($array);
when i print this array using print_r($array) it gives me
Array
(
[Meta] => SimpleXMLElement Object
(
[Query] => php programming
[ResultOffset] => SimpleXMLElement Object
(
)
[NumResults] => 25
[TotalResults] => 36839
)
[Slideshow] => Array
(
[0] => SimpleXMLElement Object
(
[ID] => 1966058
[Title] => title here
[Description] => description here
[Status] => 2
[Username] =>usrname
[URL] => url here
[ThumbnailURL] => a url
[ThumbnailSmallURL] => a url
[Embed] => some embed code
)
[1] => SimpleXMLElement Object
(
[ID] => 1966058
[Title] => title here
[Description] => description here
[Status] => 2
[Username] =>usrname
[URL] => url here
[ThumbnailURL] => a url
[ThumbnailSmallURL] => a url
[Embed] => some embed code
)
now i want to fetch this array and use its every value. i want to all nodes values of this array. so how to fetch this array using foreach loop.