Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Short Version:</strong> ( NEW )</p> <p><strong>demo:</strong> <a href="http://so.lucafilosofi.com/get-rss-feed-into-php-array-possible/" rel="nofollow noreferrer">http://so.lucafilosofi.com/get-rss-feed-into-php-array-possible/</a></p> <pre><code>$feed = 'http://stackoverflow.com/opensearch.xml'; $feed_to_array = (array) simplexml_load_file($feed); //OR $feed_to_array = (array) new SimpleXmlElement( file_get_contents($feed) ); print_r($feed_to_array); //output Array ( [ShortName] =&gt; Stack Overflow [Description] =&gt; Search Stack Overflow: Q&amp;A for professional and enthusiast programmers [InputEncoding] =&gt; UTF-8 [Image] =&gt; http://sstatic.net/stackoverflow/img/favicon.ico [Url] =&gt; SimpleXMLElement Object ( [@attributes] =&gt; Array ( [type] =&gt; text/html [method] =&gt; get [template] =&gt; http://stackoverflow.com/search?q={searchTerms} ) ) ) </code></pre> <hr> <p><strong>Long Version:</strong> ( OLD )</p> <pre><code>&lt;?php $rss_tags = array( 'title', 'link', 'guid', 'comments', 'description', 'pubDate', 'category', ); $rss_item_tag = 'item'; $rss_url = 'http://www.webaddict.info/feeds/news.xml'; $rssfeed = rss_to_array($rss_item_tag, $rss_tags, $rss_url); echo '&lt;pre&gt;'; print_r($rssfeed); function rss_to_array($tag, $array, $url) { $doc = new DOMdocument(); $doc-&gt;load($url); $rss_array = array(); $items = array(); foreach($doc-&gt; getElementsByTagName($tag) AS $node) { foreach($array AS $key =&gt; $value) { $items[$value] = $node-&gt;getElementsByTagName($value)-&gt;item(0)-&gt;nodeValue; } array_push($rss_array, $items); } return $rss_array; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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