Jump to content

PHP4 alternative to PHP5's TRY()


jasonc

Recommended Posts

I do not fully understand what this does and would really appreciate it if someone could let me know of a way to get the same results from the PHP5 command try() using a server with PHP4 on it.

 

thanks in advance for your help.

 

below is a part of the code i currently have been given, the rest of the code is not shown as this contains private 'key' info relating to access.

 

 

<?
//catch the exception that gets thrown if the cookie has an invalid session_key in it
try {
  if (!$facebook->api_client->users_isAppAdded()) {
    $facebook->redirect($facebook->get_add_url());
  }
} catch (Exception $ex) {
  //this will clear cookies for your application and redirect them to a login prompt
  $facebook->set_user(null, null);
  $facebook->redirect($appcallbackurl);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/113456-php4-alternative-to-php5s-try/
Share on other sites

There is no alternative except shaky error handling.  If the Facebook API requires try/catch blocks (I'm pretty sure it does...I need to check my code and make sure...), then you need PHP 5.  PHP4 reached it's end in like, December, so every host should now have PHP 5.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.