• 0

[PHP] Embeding RSS data in Image with GD


Question

I have written script before to use dynamic data to be embed in images, Such as the Neowin Signatures. However, I am looking for a way to Embed RSS feed data into images, such as a twitter feed, and whatnot. How would I go about creating a php script so as to pull the latest bit of data from the RSS feed and write it into the image. I know such a thing is possible simply not how to do it. Is there a tutorial somewhere that could show me this?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

This is the function I use in my RSS parser class at http://revvis.com/ :

    function parseFromURL($url) {
        if(isset($url) && !empty($url)) {
            $doc = new DOMDocument();
            $doc->load($url);
            foreach($doc->getElementsByTagName('item') as $node) {
                $items[] =
                    array( 
                        'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
                        'content' => $node->getElementsByTagName('description')->item(0)->nodeValue,
                        'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
                        'date' => strtotime($node->getElementsByTagName('pubDate')->item(0)->nodeValue)
                    );
            }
            return $items;
        }
    }

Good luck :p

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.