Gallery RSS feeds from text dumps

CyberSEO posted a small code snippet on GFY.com that allows you to take FHG dumps and “convert” them into an RSS feed:

It’s not very flexible, but maybe it’s helpful to some of you guys.

All you need is the following script. Upload it to your server as xml.php:

<?php
if (isset ( $_GET ["dump"] )) {
    $dump = file ( $_GET ["dump"] );
    $time = time ();
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    echo "<rss version=\"2.0\">\n";
    echo "<channel>\n";
    echo "<title>My Feed</title>\n";
    foreach ( $dump as $item ) {
        list ( $title, $desc, $url ) = explode ( "|", trim ( $item ) );
        echo "  <item>\n";
        echo "    <title>" . $title . "</title>\n";
        echo "    <link>" . $url . "</link>\n";
        echo "    <guid>" . $url . "</guid>\n";
        echo "    <pubDate>" . date ( "D, d M  Y H:i:s O", $time ) . "</pubDate>\n";
        echo "    <description><![CDATA[" . $desc . "]]></description>\n";
        echo "  </item>\n";
        $time -= 86400;
    }
    echo "</channel>\n";
    echo "</rss>\n";
}
?>

Then get a dump from the FHGs in the following format and also upload it to your server (e.g. site1_dump.txt)

{title}|{description}|{url}

Make sure it’s formatted correctly. Sometimes there are descriptions that have linefeeds in them. These won’t work and will corrupt the output as there is no check for these cases.

Then point your browser to xml.php?dump=site1_dump.txt and you’ll get your RSS.

It misses one important feature that you usually want from RSS, though: Automation. You need to create a dump manually and save it on your server. Then you can use the script to get the dump’s content as RSS. With this script there is no (easy) way to automatically get an updated RSS when the affiliate sponsor posts a new gallery.

That’s where you affiliate program owners need to help us webmasters. Either give us a fully featured RSS feed so that we don’t need additional tools or at least allow us to access a text dump without the need to log in manually. Don’t know how to do that? Just write me. I’m sure I can help with the coding.

(Image Credits: TarnicDotCom, script found via ThereIsNoMoneyInPorn)