2011-08-26 192 views
0

我得到一个错误致命错误:未捕获OAuthException:(#100)

error_log: Could not set cookie. Headers already sent. 
Fatal error: Uncaught OAuthException: (#100) link URL is not properly formatted thrown in /home/admin/facebook.php on line 453 

脚本工作了几个月前所以只是再次上传,并得到一个错误。这是一个定制的脚本,所以不知道什么是错的,所以认为id在这里问。这里是我的代码

require_once 'facebook.php'; 
require_once 'database.class.php'; 
require_once 'config.php'; 

/** 
* FB Session 
*/ 
$facebook = new Facebook(array(
    'appId' => FB_APP_ID, 
    'secret' => FB_SECRET, 
    'cookie' => true, 
)); 

$session = $facebook->getSession(); 
$params = array(
    'canvas'  => 1, 
    'fbconnect'  => 0, 
    'next'   => URL_CANVAS, 
    'req_perms'  => 'publish_stream, offline_access' 
); 
$loginUrl = $facebook->getLoginUrl($params); 

/** 
* User authenticated? 
*/ 
if ($session) { 
    try { 
     $fb_uid = $facebook->getUser(); 
     $me  = $facebook->api('/me'); 
     $access_token = $session['access_token']; 
     $pg  = 'main'; 
    } catch (FacebookApiException $e) { 
     echo '<script type="text/javascript">top.location.href = "' . URL_CANVAS . '";</script>'; 
     exit; 
    } 
} else { 
    $pg = 'splash'; 
} 
?> 
<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
     <meta http-Equiv="Cache-Control" Content="no-cache" /> 
     <meta http-Equiv="Pragma" Content="no-cache" /> 
     <meta http-Equiv="Expires" Content="0" /> 

     <title>bloxorz worldst hardest game can you beat it ?</title> 

     <!--// using jQuery UI for this sample app //--> 
     <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> 
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> 
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 
     <script type="text/javascript"> 
      $(function() { 
       $("#tabs").tabs(); 
      }); 
     </script> 
    </head> 
<body> 
<!--// Facebook Javascript SDK needed for IFrame Canvas App //--> 
<div id="fb-root"></div> 
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> 
<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
     FB.init({appId: '<?php echo FB_APP_ID; ?>', status: true, cookie: true, xfbml: true}); 
     FB.Canvas.setSize(); 
    }; 
    (function() { 
     var e = document.createElement('script'); 
     e.type = 'text/javascript'; 
     e.src = document.location.protocol + 
      'http://connect.facebook.net/en_US/all.js'; 
     e.async = true; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 
</script> 

<!--// START: page include //--> 
<?php 
if (!empty($pg)) { 
    include $pg . '.php'; 
} else { 
    echo '<b>Error:</b> Page Not Found.'; 
} 
?> 
<!--// END: page include //--> 

或者是在facebook.php页面的错误? 由于facebook.php线453

// results are returned, errors are thrown 
    if (is_array($result) && isset($result['error'])) { 
     $e = new FacebookApiException($result); 
     if ($e->getType() === 'OAuthException') { 
     $this->setSession(null); 
     } 
     throw $e; 
    } 
    return $result; 
    } 

回答

0

您已经开始被设置头前的“呼应”的输出。 453行的Facebook.php试图设置一些响应标题,但它不能,因为标题已经被设置并且响应正文已经开始。

请确保您没有echo,var_dumppr或在执行第453行之前向浏览器输出任何内容。

相关问题