I need a script to read a page like this http://www.stuff.co.nz/feeds/League.xml and it will set all nodes like title, link and description into a variables like $title $link

I've looked into this for several days but it's doing my head in, can someone help

    Yeah Ive read that but i seem to make a right mess of it....

      here is my try

      <?php
      $doc = new DOMDocument();
      $doc->load('http://www.stuff.co.nz/feeds/League.xml');
      //echo $doc->saveXML(); 
      
      $newNode = $dom->createElement('item id') ;
      foreach ($nodeList as &$node) {
        echo $node->nodeValue ;
        $newNode->appendChild($node) ;
      }
      
      ?>
      

        But why would you pick createElement() ? You don't want to create anything new, you just want to search the XML.

        Try using this function on that line instead: [man]domdocument.getelementsbytagname[/man].

          This code should get you started.

          $feed_details = @new SimpleXMLElement($rss_contents,LIBXML_NOCDATA);
          
          if (!empty($feed_details->channel->item)) {
            foreach ($feed_details->channel->item as $num=>$rss_object) {
              // You now have these.  You could also do print_r($rss_object) to see all options
              $rss_object->title
              $rss_object->link
              $rss_object->description
            }
          }
          
            Write a Reply...