Hello,
Im new to developing facebook apps.I have the following issue and would be glad if someone could help.
I have registered my app on facebook and uploaded the code and php client library to the hosting server. If i use the code below then everything works fine.
<?php
require_once('./facebook/php/facebook.php');
/* initialize the facebook API with your application API Key
and Secret */
$facebook = new Facebook("<my_api_key>","<my_secret_key>");
$user = $facebook->require_login();
echo "<p>Your User ID is: $user</p>";
echo "<p>Your name is: <fb:name uid=\"$user\" useyou=\"false\"/></p>";
echo "<p>You have several friends: </p>";
$friends = $facebook->api_client->friends_get();
echo "<ul>";
foreach ($friends as $friend) {
echo "<li><fb:name uid=\"$friend\" useyou=\"false\" /></li>";
}
echo "</ul>";
/* Echo some information that will
help us see what's going on with the Facebook API: */
echo "<pre>Debug:" . print_r($facebook,true) . "</pre>";
?>
But, if i divide the code into two files as follows then i just get a blank canvas when i navigate to http://apps.facebook.com/myapp
appinclude.php
<?php
require_once('./facebook/php/facebook.php');
/* initialize the facebook API with application API Key
and Secret */
$facebook = new Facebook("<my_api_key>","<my_secret_key>");
$user = $facebook->require_login();
?>
index.php
<?php
require_once('./appinclude.php');
echo "<p>Your User ID is: $user</p>";
echo "<p>Your name is: <fb:name uid=\"$user\" useyou=\"false\"/></p>";
echo "<p>You have several friends: </p>";
$friends = $facebook->api_client->friends_get();
echo "<ul>";
foreach ($friends as $friend) {
echo "<li><fb:name uid=\"$friend\" useyou=\"false\" /></li>";
}
echo "</ul>";
/* Echo some information that will
help us see what's going on with the Facebook API: */
echo "<pre>Debug:" . print_r($facebook,true) . "</pre>";
?>
Any way to fix this ?
Thank You.