Php Facebook Programmers.. question..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • goodsites
    Confirmed User
    • Jan 2010
    • 538

    #1

    Php Facebook Programmers.. question..

    I am using the Graph API to connect to facebook via logged in user and get a list of his friends on my site.. the goal is for me to send a post to their friends wall... It works fine but there is a problem I am facing, and do not understand

    The problem is this... If you go to a friends profile image and look at his profile ID< you would get back a ID # of something like...

    "100000935245404"

    Now if I dump the contents of the id's I get using a call to "/me/friends"
    it spits out id's something liek

    "287548238"

    Now if I do my post to /287548238/feed/

    it fails with some stupid error Unkown alais..

    But if I hardcode the /100000935245404/feed/ it posts to their feed fine

    So my question is "What are these ID numbers /me/friends is spitting back?"
    Am I missing something? Do I need to do another query to get the proper user profile id to post to their wall?



    provided some code for whatever reason, in case question is not clear
    if ($session) {
    try {
    $fb_uid = $facebook->getUser();
    $friends = $facebook->api('/me/friends/');
    //var_dump($friends);
    $friendslist = array_slice($friends[data], 0, 25);
    } catch (FacebookApiException $e) {
    error_log($e);
    }
    }

    if ($me) {
    $friendform = _createFBFriendForm($friendslist);
    }


    ...
    ...

    if ($session) {
    $attachment = array(
    'message' => 'test message',
    'picture' => 'http://www.test.com/',
    'link' => 'http://www.test.com',
    'name' => 'Swap',
    'caption' => "Test Swap Invitation",
    'description' => '',
    'source' => '',
    'actions' => array(array('name' => 'Swap',
    'link' => 'http://www.test2.com',
    'privacy' => 'EVERYONE' ))
    );
    // $cb == what the get/friends call id is for this particular friend
    $feedlink = "/" . $cb . "/feed";
    // echo $session['access_token']; exit;
    // echo $feedlink; exit;
    // $myfeed = $facebook->api('/100000937335201/feed/', 'post', $attachment); // this works
    $myfeed = $facebook->api($feedlink, 'post', $attachment);
    }
  • goodsites
    Confirmed User
    • Jan 2010
    • 538

    #2
    nevermind, i found a bug where it was intval'ing the facebook id, which converted it down because it a very large number...

    Thus it was providing an invalid id, the real id is what is coming back now as I thought should be <heh>

    Comment

    Working...