simpleXML how to get feed
I am trying to get the <title> and the <link> from this XML feed:

    <item>
      <title>A title</title>
      <link>http://example.com</link>
    </item>

How is this possible? I am new to PHP and I'm trying to figure it out. This is what I have so far.


     <?php
         include 'http://example/forum/index.php?action=.xml;type=rss';
    
         $channel = new SimpleXMLElement($xmlstr);
    
          echo $channel->$item[0]->title;
    ?>

But it doesn't work.
simpleXML how to get feed
===

I am trying to get the <title> and the <link> from this XML feed:

    <item>
      <title>A title</title>
      <link>http://example.com</link>
    </item>

How is this possible? I am new to PHP and I'm trying to figure it out. This is what I have so far.


     <?php
         include 'http://example/forum/index.php?action=.xml;type=rss';
    
         $channel = new SimpleXMLElement($xmlstr);
    
          echo $channel->$item[0]->title;
    ?>

But it doesn't work.