这个问题是关于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