Here is what I have so far.

<?php
$file = fopen ("http://gullible.info/gullible.rss.php", "r");
if (!$file) {
    echo "<p>Unable to open remote file.\n";
    exit;
}

while (!feof ($file)) {

$line = fgets ($file, 1024);
/* This only works if the title and its tags are on one line */
if (eregi ("<description>(.*)</description>", $line, $out)) {
    $title = $out[1];
echo $title;
break;
}

}
fclose($file);
?>

I am trying to only grab the a section of the RSS feed. Basicly the first <description> tag hold a value about the site, I want to get the second <description> tag and echo that on my page. i tried to mess around to get it, but it did not work and after looking at the code, it just looked goofy. I have no clue how to do this, basicly I just want to store the second description in $title instead of the first 1, could not find a command for next.

thanks for any help.

    May want to try using [man]preg_match_all[/man] instead of eregi. eregi will only grab the first occurance of the match, where preg_match_all will grab all instances of the match and put them in the array.

      awesome, working on it now. thanks

        k, looking at these examples and reading I am getting more confused. I think I am close, I just have no clue how to write the pattern that I want to get. I would like to just grab the info between 2 <description> tags. here is what I tried but it fails, but that is probebly because I do not understand the pattern login at all.

        <?php
        $file = fopen ("http://gullible.info/gullible.rss.php", "r");
        if (!$file) {
            echo "<p>Unable to open remote file.\n";
            exit;
        }
        while(!feof ($file)){
         $line = fgets ($file, 2048);
        
        preg_match_all("<description>(.*)</description>", $line, $description,PREG_PATTERN_ORDER );
        }
        echo $description[1];
        
        fclose($file);
        ?>
        

          This did it for me.

          <?php
          error_reporting(E_ALL);
          $file = file_get_contents("http://gullible.info/gullible.rss.php");
          if($file !== false) {
             preg_match_all("/<description>(.*)<\\/description>/i", $file, $description);
             print_r($description);
          }
          else
             echo 'Could not pull file';
          ?>
          

            K, now my next problem is how do I get the BRs in my string to make new lines? basicly I need the oposite command of nl2br(). cannot get this part to work, NO clue why its not doing it, it just keeps printing <BR> as text

              Should be able to just [man]str_replace[/man] them.

                been trying that, but what do I replace them with? i I tried \n but it did nothing, what else can I do to make it a new line?

                  Well, you may want to look at the output(not in a browser or in the source) to see what all needs to be replaced. Their break tags seem to be in htmlentities as I see it, so you'd want to be replacing &amp;lt;br&amp;gt; with \n.

                    just saw that and got it working. Thank you so much for your help.

                      Write a Reply...