DouglasAWh
October 9th, 2007, 12:02 AM
I;'m making a facebook app and I'm pretty new to PHP. My code is below.
<?php
require_once 'facebook.php';
$appapikey = 'right...';
$appsecret = 'el nadda';
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();
//[todo: change the following url to your callback url]
$appcallbackurl = 'nope';
//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);
}
?>
I am getting Parse error: parse error, unexpected '{' on line 13, which is the bracket after "try." According to http://devzone.zend.com/manual/language.exceptions.html, it looks like I've got the syntax correct. What's the deal?
<?php
require_once 'facebook.php';
$appapikey = 'right...';
$appsecret = 'el nadda';
$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();
//[todo: change the following url to your callback url]
$appcallbackurl = 'nope';
//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);
}
?>
I am getting Parse error: parse error, unexpected '{' on line 13, which is the bracket after "try." According to http://devzone.zend.com/manual/language.exceptions.html, it looks like I've got the syntax correct. What's the deal?