I'm in need of some sort of an error handling script...
My site fetches rss feeds from other sites (by using simplepie) and displays them like this: (http://netti-tv.net), but i'm having problems with one of the rss feeds, as some times the feed has no image -> my site crashes giving me this error code (http://netti-tv.net/katsomo):
Lines 133-138:PHP Code:
Warning: Invalid argument supplied for foreach() in /home2/nettib22/public_html/katsomo.php on line 133
Fatal error: Call to a member function get_link() on a non-object in /home2/nettib22/public_html/katsomo.php on line 134
I'm looking for a script that checks the rss feeds images and if there is no image it replaces it with "img/noimage.png".PHP Code:
foreach($item->get_enclosures() as $enclosure);
$i['img'] = str_replace("_m.jpg","_s.jpg" , $enclosure->get_link());
$i['img'] = 'img/noimage.png';
The above script works other vice but it has no error handling...
Sorry for my bad English. I really hope somebody could help me as it's really annoying that my site crashes...I would really appreciate it.
Edit: For now there is no error in http://netti-tv.net/katsomo but i'm still looking for the script. =/