How to post an image and text from RSS feed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pano pano
    New Member
    • Nov 2011
    • 18

    How to post an image and text from RSS feed

    I create an rss reader and i currently use the following code

    Code:
    $ch = curl_init($url);	
    	
    	curl_setopt($ch,CURLOPT_HEADER,0);
    	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    	curl_setopt($ch,CURLOPT_NOBODY,0);
    	
            $data = curl_exec($ch);
    	
    	
    	preg_match_all('/\<title[^>]*\>([^\>]+)\<\/title\>/',$data,$titles); 
    	preg_match_all('/\<link[^>]*\>([^\>]+)\<\/link\>/',$data,$links);
    
    
    if ($titles[1] != '')
    	$titles = $titles[1];
    	else $titles = array('Error','Could not process feed');
    	if ($links[1]) $links = $links[1];
    	else $links = array('','#');
    	if ($displayname == '') $displayname = $titles[0];
    	
    	
    	for ($x=1;$x<=$number;$x++) {
    		if ($trunc != FALSE) { $titles[$x] = substr($titles[$x],0,$trunc); }
    		if ($delim != FALSE) { $titles[$x] = strstr($titles[$x],$delim,true); }
    		$titles[$x] = strtr($titles[$x],array('<![CDATA['=>'',']]>'=>''));
    		if ($titles[$x] == '') { $number = $x; break; }

    The code above works well and the result i get is the web site title and the link to the web site's article.

    But now, i want to retrieve more info from the rss feed.
    Can you please help me, to change the code above, in order to also get images and some text from a feed?(or give me a general guide)
    Thanks in advance and sorry to trouble you.
  • pano pano
    New Member
    • Nov 2011
    • 18

    #2
    Correction: Currently, i only get the link from the feed, not the site title.
    Well, any suggestions?

    Comment

    Working...