久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

作為主頁而不是用戶在 Facebook 墻上發帖

Post on a Facebook wall as Page, not as user(作為主頁而不是用戶在 Facebook 墻上發帖)
本文介紹了作為主頁而不是用戶在 Facebook 墻上發帖的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

是否可以作為應用程序而不是用戶在 Facebook 墻上發帖?據我所知,某個應用程序不是 Facebook 的有效用戶,但有很多關于以主頁身份而不是用戶或應用程序發布的評論.

Is it possible to post on a Facebook wall as application and not as user? As far as I understand an application is not a valid user for Facebook, but there are numerous comments about posting as Page and not as User or Application.

如何使用 PHP Facebook API 來實現?

How can I do it using PHP Facebook API?

推薦答案

您需要 publish_stream,manage_pages 權限.代碼類似于:

You need the publish_stream,manage_pages permissions. The code is something like:

<?php
// This code is just a snippet of the example.php script
// from the PHP-SDK <https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php>
require '../src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => 'app_id',
  'secret' => 'app_secret',
));

// Get User ID
$user = $facebook->getUser();

if ($user) {
  try {
    $page_id = 'page_id';
    $page_info = $facebook->api("/$page_id?fields=access_token");
    if( !empty($page_info['access_token']) ) {
        $args = array(
            'access_token'  => $page_info['access_token'],
            'message'       => "I'm a Page!"
        );
        $post_id = $facebook->api("/$page_id/feed","post",$args);
    } else {
        $permissions = $facebook->api("/me/permissions");
        if( !array_key_exists('publish_stream', $permissions['data'][0]) ||
            !array_key_exists('manage_pages', $permissions['data'][0])) {
            // We don't have one of the permissions
            // Alert the admin or ask for the permission!
            header( "Location: " . $facebook->getLoginUrl(array("scope" => "publish_stream, manage_pages")) );
        }

    }
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl(array('scope'=>'manage_pages,publish_stream'));
}

// ... rest of your code
?>

我已經編寫了關于此的深入教程:如何:在 Facebook 頁面上作為頁面而不是使用 PHP-SDK 的管理員用戶發布

I've written and in-depth tutorial about this: How To: Post On Facebook Page As Page Not As Admin User Using PHP-SDK

這篇關于作為主頁而不是用戶在 Facebook 墻上發帖的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 国产一区二区三区免费观看在线 | 国精产品一品二品国精在线观看 | 美日韩精品 | 91资源在线观看 | 国产精品综合 | 91国内精品久久 | 亚洲影音先锋 | 色天堂影院 | av香港经典三级级 在线 | 国产精品99一区二区 | 欧美日韩国产精品一区 | 精品欧美一区二区在线观看视频 | 欧美 日韩 中文 | 在线永久看片免费的视频 | 亚洲第一av | 欧美精品一区二区三区在线四季 | 一区在线免费视频 | 亚洲一页 | 亚洲欧洲精品一区 | 久久久久亚洲精品中文字幕 | 久久成人人人人精品欧 | 日韩手机在线看片 | 一区二区三区视频在线免费观看 | 久久成人一区二区三区 | 精品欧美一区二区三区久久久小说 | 7777精品伊人久久精品影视 | 国产中的精品av涩差av | av中文在线| 国产日产精品一区二区三区四区 | 中文字幕一区二区三 | 韩国成人在线视频 | 超碰在线观看97 | 一区二区三区四区国产 | 青娱乐一区二区 | 在线成人av| 黄色精品 | 久久精品国产一区二区电影 | 国产精品欧美一区二区三区不卡 | 久久伊人一区二区 | 成人小视频在线观看 | 亚洲男女激情 |