-1

i trying get friends list from facebook using graph api and Graph secret. first i have tired Localhost its Working well.i got taotal friends of facebook. i have used Graph api and secret key.

My code Looks like

facebook.php

 <?php
require '/src/facebook.php';
$facebook = new Facebook(array(
  'appId'  => 'XXXXXXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXXXX',
));

$app_id =   'xxxxxxxxxxxxxxxxxx';
$app_secret = 'xxxxxxxxxxxxxxxx';

$user = $facebook->getUser();

if ($user) {
  try {
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}
if ($user) {
    $logoutUrl = $facebook->getLogoutUrl();

    $result = $facebook->api('/me/friends');

    print "<pre>";
    //print_r($result);
    $json_output=($result['summary']['total_count']);
    // echo "<h1>".'<p>Following</p>'. $json_output. "</h1>";
     echo '<p>Friends</p>'. "<h1>".$json_output. "</h1>";
    //echo '<div class="col-md-6 two">."<span>".$json_output."</span>""<p>FRIENDS COUNTR</p></div>';

    print "</pre>";




} else {
  $statusUrl = $facebook->getLoginUrl();
  $loginUrl = $facebook->getLoginUrl(array('scope' => 'user_friends'));
}


?>

this code i called my index html code

my top of the page i have write Looks like

 <?php
session_start();
?>

i have include facebook.php in my html page assign particular place its Looks like

                     <div class="col-md-6 two">
                                    <!--
                                    <span>36</span>
                                    <p>Following</p>--->

                                    <?php include("facebook.php"); ?>

                                </div>

this code working localhost xampp. When i move this code server side its showing that particular place blank page ?

bytecode77
  • 14,163
  • 30
  • 110
  • 141
Pixel Dev
  • 37
  • 8
  • Well, have you checked your error log? A blank page usually indicates that there's a fatal error or something. Include the error in your question. – Epodax Jul 28 '15 at 11:06
  • not showing any error i have tired error_reporting that time also showing blank page – Pixel Dev Jul 28 '15 at 11:07
  • You mean the whole page is blank? Then go read this: http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/12772851#12772851 – CBroe Jul 28 '15 at 12:15

1 Answers1

0

There is probably some error on your page when running it on the server but you probably have error reporting turned off on the server. If you can turn on PHP error reporting on your server you'll probably be able to track down the problem pretty quickly.

A quick guess would be that you haven't uploaded the required file 'src/facebook.php'

jx12345
  • 1,650
  • 2
  • 22
  • 40
  • i have uploaded all code same code working localhost xampp server. in my localhost i got answer total friends list but server side not working – Pixel Dev Jul 28 '15 at 11:09