Facebook 发布流

发布于 2024-11-25 19:24:13 字数 1980 浏览 1 评论 0原文

我有问题...我确实关注了 此网站...我不擅长 facebook API..抱歉,我真的是 API 新手。.

我的代码:

<?php


define('FB_APIKEY', '***************************');
define('FB_SECRET', '***************************');
define('FB_SESSION', '***************************');

require_once 'facebook-platform/php/facebook.php';

echo "post on wall";
echo "<br/>";

try {
 $facebook = new Facebook(FB_APIKEY, FB_SECRET);
 $facebook->api_client->session_key = FB_SESSION;
 $facebook->api_client->expires = 0;
 $message = 'testasdfsadf';

 $attachment = array(
 'name' => $_POST["name"],
 'href' => $_POST["href"],
 'description' => $_POST["description"],
 'media' => array(array('type' => 'image',
 'src' => $_POST["src"],
 'href' => $_POST["href"])));

 $action_links = array( array('text' => 'TITLE', 'href' => 'http://www.mysite.com'));

 $attachment = json_encode($attachment);
 $action_links = json_encode($action_links);

 $target_id = "2410160********";
 $session_key = FB_SESSION;


     if( $facebook->api_client->stream_publish($message, $attachment, $action_links, null, $target_id)) {
     echo "Added on FB Wall";
     }
     } catch(Exception $e) {
     echo $e . "<br />";
     }
?>

我收到错误:

post on wall
exception 'FacebookRestClientException' with message 'The user hasn't authorized the application to perform this action' in /Users/*****/Sites/FacebookTEST/facebook-platform/php/facebookapi_php5_restlib.php:3025 Stack trace: #0 /Users/******/Sites/FacebookTEST/facebook-platform/php/facebookapi_php5_restlib.php(916): FacebookRestClient->call_method('facebook.stream...', Array) #1 /Users/******/Sites/FacebookTEST/index.php(46): FacebookRestClient->stream_publish('testasdfsadf', '{"name":null,"h...', '[{"text":"TITLE...', NULL, '2410160********') #2 {main}

i have problem... I did follow this site... Im not good at facebook API.. sorry im really noobs with API..

my code:

<?php


define('FB_APIKEY', '***************************');
define('FB_SECRET', '***************************');
define('FB_SESSION', '***************************');

require_once 'facebook-platform/php/facebook.php';

echo "post on wall";
echo "<br/>";

try {
 $facebook = new Facebook(FB_APIKEY, FB_SECRET);
 $facebook->api_client->session_key = FB_SESSION;
 $facebook->api_client->expires = 0;
 $message = 'testasdfsadf';

 $attachment = array(
 'name' => $_POST["name"],
 'href' => $_POST["href"],
 'description' => $_POST["description"],
 'media' => array(array('type' => 'image',
 'src' => $_POST["src"],
 'href' => $_POST["href"])));

 $action_links = array( array('text' => 'TITLE', 'href' => 'http://www.mysite.com'));

 $attachment = json_encode($attachment);
 $action_links = json_encode($action_links);

 $target_id = "2410160********";
 $session_key = FB_SESSION;


     if( $facebook->api_client->stream_publish($message, $attachment, $action_links, null, $target_id)) {
     echo "Added on FB Wall";
     }
     } catch(Exception $e) {
     echo $e . "<br />";
     }
?>

I got error:

post on wall
exception 'FacebookRestClientException' with message 'The user hasn't authorized the application to perform this action' in /Users/*****/Sites/FacebookTEST/facebook-platform/php/facebookapi_php5_restlib.php:3025 Stack trace: #0 /Users/******/Sites/FacebookTEST/facebook-platform/php/facebookapi_php5_restlib.php(916): FacebookRestClient->call_method('facebook.stream...', Array) #1 /Users/******/Sites/FacebookTEST/index.php(46): FacebookRestClient->stream_publish('testasdfsadf', '{"name":null,"h...', '[{"text":"TITLE...', NULL, '2410160********') #2 {main}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

肤浅与狂妄 2024-12-02 19:24:13

我找到答案:

这里解决方案:
http://www.facebook.com/connect/prompt_permissions.php?api_key=YOUR_API_KEY&v=1.0&next=http://www .facebook.com/connect/login_suc cess.html?xxRESULTTOKENxx&display=page&ext_perm=publish_stream,offline_access&enable_profile_selector=1&profile_selector_ids=ID_OF_YOUR_PAGE

以粗体文本插入您的 API 密钥和页面 ID。

I found answer:

here solution:
http://www.facebook.com/connect/prompt_permissions.php?api_key=YOUR_API_KEY&v=1.0&next=http://www.facebook.com/connect/login_success.html?xxRESULTTOKENxx&display=page&ext_perm=publish_stream,offline_access&enable_profile_selector=1&profile_selector_ids=ID_OF_YOUR_PAGE

Insert your API Key and Page ID in BOLD text..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文