View Single Post
Old 11-23-2010, 07:30 AM  
goodsites
Confirmed User
 
Industry Role:
Join Date: Jan 2010
Location: Over the rainbows
Posts: 538
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 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote