Re: [fw-general] Zend_Feed::import link down

2009-01-17 Thread PHPScriptor

Thank you both. I took the Zend_Exception... just to make sure that I catch
all the exceptions :-))


Simone Carletti wrote:
> 
> Or you can even decide to catch a Zend_Exception to be sure to rescue any
> Zend-related exception raised by Zend_Feed, including Zend_Http and
> Zend_Feed errors.
> 
> -- Simone
> 
> 
> On Sat, Jan 17, 2009 at 2:39 PM, Chris Weldon 
> wrote:
> 
>> On Sat, Jan 17, 2009 at 5:06 AM, PHPScriptor 
>> wrote:
>> > "Fatal error: Uncaught exception 'Zend_Http_Client_Exception' with
>> message
>>
>> Try catching Zend_Http_Client_Exception in addition to
>> Zend_Feed_Exception like you have below.
>>
>> >
>> > try {
>> >  $slashdotRss  =
>> Zend_Feed::import('http://www.test.eu/rss.php'
>> );
>> >  foreach ($slashdotRss as $item) {
>> >$channel1[] = array(
>> >'title' => $item->title(),
>> >'link'  => $item->link(),
>> >'description'   => $item->description());
>> >  }
>> >  $this->view->nieuwskan = $channel1;
>> > }
>> > catch (Zend_Feed_Exception $e) {
>> > }
>>
>> try {
>>  // try it
>> } catch (Zend_Http_Client_Exception $e) {
>>  // handle it
>> } catch (Zend_Feed_Exception $e) {
>>   // handle it
>> }
>>
>> --
>> Christopher Weldon
>> http://chrisweldon.net
>> ch...@chrisweldon.net
>>
> 
> 
> 
> -- 
> Simone Carletti
> 
> Site & Blog: www.simonecarletti.com
> Email: wep...@weppos.net
> LinkedIn: http://linkedin.com/in/weppos
> 
> 


-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/Zend_Feed%3A%3Aimport--link-down-tp21515256p21517126.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Feed::import link down

2009-01-17 Thread Simone Carletti
Or you can even decide to catch a Zend_Exception to be sure to rescue any
Zend-related exception raised by Zend_Feed, including Zend_Http and
Zend_Feed errors.

-- Simone


On Sat, Jan 17, 2009 at 2:39 PM, Chris Weldon  wrote:

> On Sat, Jan 17, 2009 at 5:06 AM, PHPScriptor 
> wrote:
> > "Fatal error: Uncaught exception 'Zend_Http_Client_Exception' with
> message
>
> Try catching Zend_Http_Client_Exception in addition to
> Zend_Feed_Exception like you have below.
>
> >
> > try {
> >  $slashdotRss  = 
> > Zend_Feed::import('http://www.test.eu/rss.php'
> );
> >  foreach ($slashdotRss as $item) {
> >$channel1[] = array(
> >'title' => $item->title(),
> >'link'  => $item->link(),
> >'description'   => $item->description());
> >  }
> >  $this->view->nieuwskan = $channel1;
> > }
> > catch (Zend_Feed_Exception $e) {
> > }
>
> try {
>  // try it
> } catch (Zend_Http_Client_Exception $e) {
>  // handle it
> } catch (Zend_Feed_Exception $e) {
>   // handle it
> }
>
> --
> Christopher Weldon
> http://chrisweldon.net
> ch...@chrisweldon.net
>



-- 
Simone Carletti

Site & Blog: www.simonecarletti.com
Email: wep...@weppos.net
LinkedIn: http://linkedin.com/in/weppos


Re: [fw-general] Zend_Feed::import link down

2009-01-17 Thread Chris Weldon
On Sat, Jan 17, 2009 at 5:06 AM, PHPScriptor  wrote:
> "Fatal error: Uncaught exception 'Zend_Http_Client_Exception' with message

Try catching Zend_Http_Client_Exception in addition to
Zend_Feed_Exception like you have below.

>
> try {
>  $slashdotRss  = Zend_Feed::import('http://www.test.eu/rss.php');
>  foreach ($slashdotRss as $item) {
>$channel1[] = array(
>'title' => $item->title(),
>'link'  => $item->link(),
>'description'   => $item->description());
>  }
>  $this->view->nieuwskan = $channel1;
> }
> catch (Zend_Feed_Exception $e) {
> }

try {
  // try it
} catch (Zend_Http_Client_Exception $e) {
  // handle it
} catch (Zend_Feed_Exception $e) {
  // handle it
}

-- 
Christopher Weldon
http://chrisweldon.net
ch...@chrisweldon.net


[fw-general] Zend_Feed::import link down

2009-01-17 Thread PHPScriptor

Hello,

I'm using a feed on my site for news. Now, when the feed site is down my
site crashes. Is there a way for not showing this 'fatal error'? And my
second question: it only crashes after e.g. 15 seconds, but I want to move
on faster. If the rss site is down it has to go further after e.g. 2
seconds...

It still throws this exception:

"Fatal error: Uncaught exception 'Zend_Http_Client_Exception' with message
'Unable to read response, or response is empty' in
C:\wamp\php\Zend\Http\Client.php:836 Stack trace: #0
C:\wamp\php\Zend\Feed.php(171): Zend_Http_Client->request('GET') #1
C:\wamp\www\kantersnet\app\modules\default\controllers\IndexController.php(22):
Zend_Feed::import('http://www.test...') #2
C:\wamp\php\Zend\Controller\Action.php(502): IndexController->indexAction()
#3 C:\wamp\php\Zend\Controller\Dispatcher\Standard.php(293):
Zend_Controller_Action->dispatch('indexAction') #4
C:\wamp\php\Zend\Controller\Front.php(946):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #5
C:\wamp\www\kantersnet\application.php(180):
Zend_Controller_Front->dispatch() #6
C:\wamp\www\kantersnet\application.php(48):
ZfApplication->dispatch(Object(Zend_Controller_Front)) #7
C:\wamp\www\kantersnet\public_html\index.php(57): ZfApplication->bootstrap()
#8 {main} thrown in C:\wamp\php\Zend\Http\Client.php on line 836"

try {
  $slashdotRss  = Zend_Feed::import('http://www.test.eu/rss.php');
  foreach ($slashdotRss as $item) {
$channel1[] = array(
'title' => $item->title(),
'link'  => $item->link(),
'description'   => $item->description());
  }
  $this->view->nieuwskan = $channel1;
}
catch (Zend_Feed_Exception $e) {
}

-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/Zend_Feed%3A%3Aimport--link-down-tp21515256p21515256.html
Sent from the Zend Framework mailing list archive at Nabble.com.