這個問題是關於Dashboard.addNews和Dashboard.publishActivityFacebook儀表板API ....無法使用它:|
Facebook已經向公衆通報其新的Dashboard API,但它沒有提供關於其圖書館的任何更新使用新的代碼。
所以我在此鏈接,隨後建議 http://forum.developers.facebook.com/viewtopic.php?pid=197753 新的功能添加到facebookapi_php5_restlib.php
//dashboard functions
public function dashboard_addNews($uid, $news, $image = null) {
return $this->call_method('facebook.dashboard.addNews',
array('uid' => $uid,
'news' => $news,
'image' => $image));
}
public function dashboard_multiAddNews($uids, $news, $image = null) {
return $this->call_method('facebook.dashboard.multiAddNews',
array('uids' => $uids ? json_encode($uids) : null,
'news' => $news,
'image' => $image));
}
public function dashboard_addGlobalNews($news, $image = null) {
return $this->call_method('facebook.dashboard.addGlobalNews',
array('news' => $news,
'image' => $image));
}
public function dashboard_publishActivity($activity, $image = null) {
return $this->call_method('facebook.dashboard.publishActivity',
array('activity' => $activity,
'image' => $image));
}
public function dashboard_multiIncrementCount($uids) {
return $this->call_method(
'facebook.dashboard.multiIncrementCount', array('uids' => json_encode($uids)));
}
public function dashboard_removeActivity($activity_ids) {
return $this->call_method(
'facebook.dashboard.removeActivity', array('activity_ids' => json_encode($activity_ids)));
}
public function dashboard_setCount($uid, $count) {
return $this->call_method('facebook.dashboard.setCount',
array('uid' => $uid,
'count' => $count));
}
但現在當我按照示例代碼在 http://wiki.developers.facebook.com/index.php/Dashboard.addNews
$image = 'http://www.martialdevelopment.com/wordpress/wp-content/images/cheezburger-or-dim-mak.jpg';
$news = array(array('message' => 'Your friend @:563683308 just sent you a present!', 'action_link' => array('text' => 'Get Your Gift', 'href' => 'http://www.example.com/gifts?id=5878237')));
$facebook->api_client->dashboard_addNews($user_id, $news, $image);
但它會提示此錯誤:
[Wed Jan 27 03:42:27 2010] [error] [client 127.0.0.1] PHP Notice: Array to string conversion in /var/local/site/webroot/xxxx/facebookapi_php5_restlib.php on line 2009
在該行的PHP代碼
if (is_array($val)) $val = implode(',', $val);
請注意,我沒有改變facebookapi_php5_restlib.php除了粘貼這些建議儀表板的功能代碼。
,當我按照指示在http://wiki.developers.facebook.com/index.php/Dashboard.publishActivity,並嘗試使用它:
$image = 'http://www.martialdevelopment.com/wordpress/wp-content/images/cheezburger-or-dim-mak.jpg';
$activity = array(array('message' => '{*actor*} just sponsored @:563683308!', 'action_link' => array('text' => 'Sponsor this cause', 'href' => 'http://www.example.com/games?id=5878237')));
$facebook->api_client->dashboard_publishActivity($activity, $image);
它拋出了同樣的錯誤太多關於「陣列字符串轉換」
任何建議實際使用新Facebook儀表板API?
嘿它的內部facebookapi_php5_restlib.php原代碼 – Unreality 2010-01-27 04:38:49