图表Facebook API,当试图发布到用户的墙时给出cURL错误
All,
我有以下代码:
All, I have the following code:
<?php
require_once 'facebook.php';
$app_id = "1234";
$app_secret = "45678";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$result = $facebook->api("/me/accounts?access_token=123456");
foreach($result["data"] as $page) {
echo $page["name"];
$page_id = "81918";
if($page["id"] == $page_id) {
$page_access_token = $page["access_token"];
break;
}
}
$args = array(
'access_token' => $page_access_token,
'message' => "I'm a Page!"
);
$post_id = $facebook->api("/$page_id/feed","post",$args);
?>
执行此操作时,我会收到以下消息:
When I execute this, I get the following message:
致命错误:未捕获CurlException:77:错误设置证书验证位置:CAfile:D:\ My Documents \xampp\htdocs\website / fb_ca_chain_bundle.crt CApath:none抛出在D:\ My Documents \xampp \htdocs\website\base_facebook.php on line 853
Fatal error: Uncaught CurlException: 77: error setting certificate verify locations: CAfile: D:\My Documents\xampp\htdocs\website/fb_ca_chain_bundle.crt CApath: none thrown in D:\My Documents\xampp\htdocs\website\base_facebook.php on line 853
不知道为什么我得到这个错误。谁能帮助我,让我知道我做错了什么?提前感谢!
I'm not sure why I'm getting this error. Can anyone help me out and let me know what I'm doing wrong? Thanks in advance!
编辑:如果有帮助任何人,我在本地主机上运行XAMPP。
I'm running XAMPP on my localhost here if that helps anyone.
没有意识到我需要获得Facebook证书。证书可以在这里找到:
Didn't realize that I needed to get the facebook certificate. The certificate can be found here:
https://github.com/facebook/facebook-php-sdk/blob/master/src/fb_ca_chain_bundle.crt
只要把它放在你base_facebook.php文件所在的目录中即可。
Just put this in the same directory that you're base_facebook.php file is in.