I'm playing around with output buffering, but I'm not having any luck with the test files I'm goofing around with.
I have a link to an XML RSS 2.0 file. What I'd like to do is open the file, read it into the buffer, and while it's in the buffer, modify any and all <link> contents using a simple eregi_replace. Using the examples on php.net as a starting point, I did this: ---------- <?php $url = "http://www.reallylonglinktoanxmlfile.com/foo.xml"; // insert your own XML RSS link here for testing function callback($buffer) { $foo = preg_replace('<link>([a-zA-Z0-9\/\.\:\?\=\&\;]*)</link>', '<link><a href="ci.php?url=\1">\1</link>', $buffer); return $foo; } $fo = fopen($url, "r"); $buffer = fread($fo, 1000000); fclose($fo); ob_start("callback"); ?> <html> <body> </body> </html> <?php ob_end_flush(); ?> ------------ But I'm getting nothing. Probably because while I understand the premise, I don't get exactly what's going on or where the output is displayed once you call it using ob_end_flush(). What I'm attempting to do is prepend '<a href="ci.php?url=' onto the beginning of each URL held in a <link> tag inside the XML before displaying it. If someone has the time to explain this to me (and anyone else here who is curious about output buffering) I would greatly appreciate it. Best, -Bob Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
