duanchi19820419 2015-07-28 11:04
浏览 42

Facebook Api好友列表不工作的服务器

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 ?

  • 写回答

1条回答 默认 最新

  • dongle2627 2015-07-28 11:07
    关注

    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'

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用