Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
facebook api关键问题php_Php_Facebook - Fatal编程技术网

facebook api关键问题php

facebook api关键问题php,php,facebook,Php,Facebook,我得到一个无效的API密钥,它绝对正确-没有空格或什么都没有-我被卡住了 Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Invalid API key' in /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php:3112 Stack trace: #0 /ho

我得到一个无效的API密钥,它绝对正确-没有空格或什么都没有-我被卡住了

Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Invalid API key' in /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php:3112 Stack trace: #0 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php(309): FacebookRestClient->call_method('facebook.auth.g...', Array) #1 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebook.php(206): FacebookRestClient->auth_getSession('c6b7baef6d609ba...', false) #2 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebook.php(167): Facebook->do_get_session('c6b7baef6d609ba...') #3 /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebook.php(68): Facebook->validate_fb_params() #4 /home/maxer/domains/follor.com/public_html/xmasapp/index.php(15): Facebook->__construct('?99a8a43434baf7...', '?02365dce6ae555...') #5 {main} thrown in /home/maxer/domains/follor.com/public_html/xmasapp/facebook/php/facebookapi_php5_restlib.php on line 3112

您是否提供了正确的应用程序密钥、应用程序密钥和应用程序ID变量。因为所有这些对于输出的正确性都很重要

我写了一些类似的东西,效果很好

$fbconfig['appid']=“################”

$fbconfig['api']=“xxxxxxxxxxxxx”;
$fbconfig['secret']=“xxxxxxxxxxxxxxxxxx”;
试一试{
包括_once“facebook.php”;
}
捕获(例外$o){
回声';
印刷费($o);
回声';
}
//创建我们的应用程序实例。
$facebook=新的facebook(数组)(
'appId'=>$fbconfig['appId'],
'secret'=>$fbconfig['secret'],
“cookie”=>正确,
));

不确定是否会产生该错误,但您的服务器是否运行PHP5?该密钥是否在您在facebook应用程序设置中列出的正确域上使用?我刚刚注意到,我怀疑API密钥是否应以
开头?
$fbconfig['api'   ]  = "xxxxxxxxxxxxxxx";

$fbconfig['secret']  = "xxxxxxxxxxxxxxxx";


try{
    include_once "facebook.php";
}
catch(Exception $o){
    echo '<pre>';
    print_r($o);
    echo '</pre>';
}
// Create our Application instance.
$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
  'cookie' => true,
));