I create an rss reader and i currently use the following code
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.
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.
Comment