Okay,
So, I've been dabbling with the Graph API for a couple of days now. I know how to post a simple message to a user's wall. But, I need to post multiple links to a user's wall. And apparently, that's not possible using my previous method. I'm so lost here. What I need to so is post content to a user's wall once they have made a prediction on the my site. So, for example I need to have a post on the user's wall that reads:
<?php
echo '<img src="img/teams/'.$winning_team.'.png" alt="'.$winning_team.'" /> '.$user_name.' predicted the '.$winning_team.' to beat the '.$losing_team.' on '.$game_date.''; ?>
Does anyone have any idea how I could achieve this using the graph API? I already set up custom actions and objects on FB. But, don't quite know where to go from here.
Thanks
The code that I have is as follows:
$facebook = new Facebook(array(
'appId' => 'appID',
'secret' => 'secret',
'cookie' => true
));
$access_token = $facebook->getAccessToken();
$user = $facebook->getUser();
if($user != 0)
{
$attachment = array(
'access_token' => $access_token,
'game' => 'http://www.sportannica.com',
'away_team' => 'New York Yankees',
'home_team' => 'New York Mets'
);
$opts = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.1',
CURLOPT_POSTFIELDS => $attachment,
CURLOPT_URL => 'https://graph.facebook.com/me/predict-edit-add:predict'
);
$ch = curl_init();
curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
}