Note that there are some explanatory texts on larger screens.

plurals
  1. POArray having simplexml object.How to fetch it using foreach loop
    text
    copied!<p>i am having this code that is used for parsing a xml url and stores output in the $query variable. </p> <pre><code> $url = 'http://www.slideshare.net/api/2/search_slideshows?api_key=GRCsS0fPo&amp; ts=1320547556&amp;hash=cf362f863d1f15e84c7a520804f7826731f958c4&amp;q=electrical+engineering&amp; page=4&amp;download=0&amp;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 '&lt;pre&gt;'; print_r($array); </code></pre> <p>when i print this array using print_r($array) it gives me</p> <pre><code>Array ( [Meta] =&gt; SimpleXMLElement Object ( [Query] =&gt; php programming [ResultOffset] =&gt; SimpleXMLElement Object ( ) [NumResults] =&gt; 25 [TotalResults] =&gt; 36839 ) [Slideshow] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [ID] =&gt; 1966058 [Title] =&gt; title here [Description] =&gt; description here [Status] =&gt; 2 [Username] =&gt;usrname [URL] =&gt; url here [ThumbnailURL] =&gt; a url [ThumbnailSmallURL] =&gt; a url [Embed] =&gt; some embed code ) [1] =&gt; SimpleXMLElement Object ( [ID] =&gt; 1966058 [Title] =&gt; title here [Description] =&gt; description here [Status] =&gt; 2 [Username] =&gt;usrname [URL] =&gt; url here [ThumbnailURL] =&gt; a url [ThumbnailSmallURL] =&gt; a url [Embed] =&gt; some embed code ) </code></pre> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload