Facebook Dashboard API ...

2 Cevap php

Bu soru yaklaşık Dashboard.addNews ve Dashboard.publishActivity

Facebook ancak yeni kodu kullanmak için, kendi kütüphanesinden herhangi bir güncelleştirme sunmamıştır, yeni Dashboard API hakkında kamu söyledi.

So I followed the advice in this link http://forum.developers.facebook.com/viewtopic.php?pid=197753 to add the new functions to the 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));
  }

But now when I follow the sample code at 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);

Ancak bu hatayı isteyecektir:

[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 çizgisinde kodudur

if (is_array($val)) $val = implode(',', $val);

pls O önerdi pano fonksiyon kodu yapıştırarak dışında facebookapi_php5_restlib.php değişmiş değil fark.

ve ben http://wiki.developers.facebook.com/index.php/Dashboard.publishActivity de talimat takip ve kullanmaya çalıştığınızda:

$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);

o "dize dönüştürme Dizisi" hakkında çok aynı hatayı dışarı atar

Herhangi bir öneri aslında yeni Facebook Dashboard API kullanmak?

Çok teşekkürler.

Ben kesinlikle tamamen uygulanabilir kod örneği ile cevap upvote olacak

2 Cevap

Tamam, ben hiç mi hiç gerek php sınıfını değiştirmek için bulundu.

Yapmamız gereken tüm call_method kullanmaktır

$news = array(array('message' => 'There is a new level in the dungeon!', 'action_link' => array('text' => 'Play now.', 'href' => 'http://www.example.com/gifts?id=5878237'))); 
$facebook->api_client->call_method('facebook.dashboard.addGlobalNews', array('news' => $news));

Eğer aynı değişkene atamak istemiyorsanız, uyarı muhtemelen gidecek:

if (is_array($val)) $stringval = implode(',', $val);