[fw-core] check RSS available before using

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[fw-core] check RSS available before using

sina miandashti
hi

im using this code for getting a feed :

$feed = new Zend_Feed_Rss("
http://forums.ipbfarsi.ir/index.php?/rss/forums/3-%D8%A2%D8%AE%D8%B1%DB%8C%D9%86-%D8%A7%D8%AE%D8%A8%D8%A7%D8%B1-%D8%AF%D8%B1-%D9%85%D9%88%D8%B1%D8%AF-%D9%85%D8%AD%D8%B5%D9%88%D9%84%D8%A7%D8%AA-ips/
");
                $feedArray = array();
                $i=0;
                foreach ($feed as $item) {
                    //echo $item->title() . "<br>";
                    $array = array();
                    $array['title'] = $item->title();
                    $array['link'] = $item->link();
                    $feedArray[] = $array;

                    if ($i == 4) break;
                    $i++;
                }


any way simple and best to check if rss available and is not in error
(404/500/ or other http/XML error) ?



--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin