views:

10

answers:

2

I am working on my second Facebook App and seem to have run into a problem. On my first App, I used

$user_id = $facebook->require_login();

to get the ID of the user that was using my app. It worked great, and still does. However, on my second App, I used the same thing but keep getting the old 500 Internal Server Error. ( Using Opera as browser ) Not sure why, since the exact same code works on the other App. Here it is:

<?php
require_once('facebook.php');
$appapikey = 'APIKEYHERE';
$appsecret = 'SECRETKEYHERE';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
echo $user_id;
echo "Hello!";
?>

I have checked the server and PHP logs, none of them report any errors.

A: 

500 internal server error ussually comes from an error in your code, not browser related anyway.

Also, the API should work just fine. Try replacing

include 'facebook.php';

with

require_once('facebook.php');

Also, is this everything you have in the code?

Claudiu
Yes, everything I posted is what is in the actual document.
Zachary Brown
I changed it as you said, but the same error is present.
Zachary Brown
What about your application settings? I created the last app last week, worked just fine. The only diff. in the way I connected was that I also asked for some permissions...
Claudiu
The settings are the same as the other app. I also just noticed, I used: $user_id = $facebook->require_login(); : on the index page of this same app. It works fine there.
Zachary Brown
What permissions did you ask for?
Zachary Brown
CHanged it to include_once('facebook.php'); and works like a charm now! Thanks everyone!
Zachary Brown
A: 

How long ago did you write your first app? Facebook has got rid of the old APIs (although left them there for old apps to continue to work), but all new apps have to use the Graph API instead.

Take a look here for more information. http://developers.facebook.com/docs/guides/canvas/

Also, take a look at this documentation. http://developers.facebook.com/docs/api

Codemwnci
My first app is only a couple weeks old.
Zachary Brown