aminjam
aminjam

Reputation: 646

Simple "facebook.php" is not working

I am fairly new to the PHP world and facebook integration. I am trying to connect my website to my facebook page to get the content, but a simple program seems to not working. I made sure to get the latest version of facebook code at github. Here is what I have in "test.php":

<!DOCTYPE html>
   <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>My Pictures</title>
    </head>
   <body>
   <a> hello 1 </a>
   <?php
   echo '<a> hello 2 </a>';
   include_once 'src/facebook.php';
   echo '<a> hello 3 </a>';
   include_once 'src/config.php';
   echo '<a> hello 4 </a>';
   $facebook = new Facebook(array(
       'appId'  => FACEBOOK_APP_ID,
       'secret' => FACEBOOK_SECRET_KEY,
       'cookie' => true,
       'domain' => 'uuu.com'
   ));
   echo '<a> hello 5 </a>';
   ?>

   </body>

Just some notes, I know the path for facebook is correct, I tried to put other files, and it worked perfectly, but with this I only see "Hello 1 Hello 2", so it looks like the facebook.php is failing at something, but I don't what, and don't know how to check what it is. Any help would be appreciated, thank you.

Upvotes: 2

Views: 665

Answers (1)

Daxcode
Daxcode

Reputation: 434

   $facebook = new Facebook(array(
       'appId'  => FACEBOOK_APP_ID,
       'secret' => FACEBOOK_SECRET_KEY,
       'cookie' => true,
       'domain' => 'uuu.com'
   ));

do you have registered your facebook app in getting an id and the secret key?

Be also aware, the facebook communication might not work through localhost. But to be ensure, try to enforce the error output on your webpage through following codelines, so you're able to identify in more details why it is not working (post then the output as a follow up here, in getting a better support for solvement):

ini_set('display_errors', '1');
error_reporting(E_ALL);

Upvotes: 1

Related Questions