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

如何使用 FB Graph 在提要(墻)上發布消息

Howto use FB Graph to post a message on a feed (wall)(如何使用 FB Graph 在提要(墻)上發布消息)
本文介紹了如何使用 FB Graph 在提要(墻)上發布消息的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我已經創建了一個應用程序,現在我想使用新的 Graph API 在我的一個朋友墻上發布一條消息.這能行嗎?

I have created an app, and now i want to post a message on one of my friends wall with use of the new Graph API. Is this do-able?

我已經在使用 oAuth 和 Graph-api 來獲取我所有朋友的列表.http://developers.facebook.com/docs/api 上的 API 告訴我 cURLhttps://graph.facebook.com/[userid]/feed 閱讀feed,但它也告訴我如何發布消息:

I am already using oAuth and the Graph-api to get a list of all my friends. The API at http://developers.facebook.com/docs/api tells me to cURL https://graph.facebook.com/[userid]/feed to read the feed, but it also tells me howto post a message:

curl -F 'access_token=[...]' -F 'message=Hello, Arjun. I like this new API.' https://graph.facebook.com/arjun/feed

這當然不行!我不知道為什么..

Ofcourse this doesn't work! And I can't find out why..

這是我的 PHP 代碼:

Here are my PHP-code:

require_once 'facebook.php'; // PHP-SDK downloaded from http://github.com/facebook/php-sdk
$facebook = new Facebook(array(appId=>123, secret=>'secret'));
$result = $facebook->api(
        '/me/feed/',
        array('access_token' => $this->access_token, 'message' => 'Playing around with FB Graph..')
);

這段代碼沒有拋出任何錯誤,而且我知道我的 access_token 是正確的(否則我無法運行 $facebook->api('/me?access_token='.$this->access_token); 來獲取我的用戶對象.

This code does not throws any error, and I know my access_token are correct (otherwise i could't run $facebook->api('/me?access_token='.$this->access_token); to get my userobject.

有沒有人使用 Graph-api 成功發布消息?那么我需要你的幫助!:-)

Have anyone out there sucsessfully posted a message using Graph-api? Then i need your help! :-)

推薦答案

好的,我終于解決了這個問題.感謝 phpfour 的幫助:-)

Okay, I finally solved this. Thanx to phpfour for your help :-)

首先:我的連接 url 看起來像這樣(帶有publish_stream"):

First: My connection-url looks like this (with "publish_stream"):

$connectUrl = $this->getUrl(
  'www',
  'login.php',
  array_merge(array(
    'api_key'         => $this->getAppId(),
    'cancel_url'      => $this->getCurrentUrl(),
    'req_perms'       => 'publish_stream',
    'display'         => 'page',
    'fbconnect'       => 1,
    'next'            => $this->getCurrentUrl(),
    'return_session'  => 1,
    'session_version' => 3,
    'v'               => '1.0',
  ), $params)
);

第二;我試圖通過

$result = $facebook->api(
    '/me/feed/',
    array('access_token' => $this->access_token, 'message' => 'Playing around with FB Graph..')
);

但正確的做法是多包含一個參數('post'):

But the correct way to do this is include one more parameter ('post'):

$result = $facebook->api(
    '/me/feed/',
    'post',
    array('access_token' => $this->access_token, 'message' => 'Playing around with FB Graph..')
);

這篇關于如何使用 FB Graph 在提要(墻)上發布消息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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久久 | 亚洲成人中文字幕 | 精品乱码一区二区三四区 | 美女视频黄色的 | 国产精品成人一区二区 | 亚洲婷婷六月天 | 天堂网色 | 中文字幕久久久 | 亚洲精品一二区 | 精品欧美一区二区三区久久久 | 国产成人精品免高潮在线观看 | 四虎在线观看 | v片网站 | 懂色av一区二区三区在线播放 | 亚洲免费观看视频 | 日韩视频在线一区 | 久久亚洲国产精品日日av夜夜 | 日韩在线视频一区 | 国产精品久久久久久吹潮日韩动画 | 成年人在线观看 | 99热这里有精品 | 夜久久 | 99这里只有精品视频 | 国产精品久久久久久久久久久免费看 | av在线免费观看不卡 | 视频一区二区在线观看 | 欧美一区2区三区4区公司二百 | 少妇一级淫片免费播放 | 亚洲一区二区视频 | www亚洲精品 | 国产国语精品 | 黄色成人av |