hey guys.
I downloaded the ifpc demo and put all of the include files and such and what I am trying to do is when a user selects a friend from a list provided to him the application posts a comment on that friends page.
I get the list of friends using REST calls but my problem is that when I call my postTo method it gives me a: error: Open social token not set.
Any help would be appreciated. Here is my code:
THE CODE TO GET ALL OF THE FRIENDS
<?php
$myspace = new MySpaceAPI($consumer_key,$consumer_secret);
$friendArray = $myspace->get_friends($platformId);
//$resourceToken = $myspace->OAuthToken->get_authorization_url("http://www.undergroundmusix.com/myspaceapp/umusix_php/container.php5",$requestToken);
// $resourceToken = $myspace->OAuthToken->get_authorization_url("http://www.explosm.net",$requestToken);
// $result = $myspace->OAuthToken->get_access_token();
// $friends = $myspace->People->get_people_friends($platformId);
$friend = $friendArray["friends"];
foreach($friend as $f){
echo(' <li class="ui-state-default ui-corner-all friend" title="Your Friend" id='.$f['userid'].'>');
echo($f['displayname']);
echo('<span class="ui-icon ui-icon-circle-plus inviteFriend" title= "Invite Friend" id='.$f['userid'].'></span>');
echo('</li>');
}
?>
using jquery i link the onclick even to call my post to function:
POST TO FUNCTION:
function postTo(friendID){
MyOpenSpace.MySpaceContainer.get().registerParam("panelId", "apppanel_133049_canvas");
MyOpenSpace.MySpaceContainer.get().registerParam("localRelay", "http://www.undergroundmusix.com/myspaceapp/umusix_php/ifpc_relay_external001.html");
var postback = function(response){
if (response.errorMessage){
alert("Error: " + response.errorMessage);
return;
}
switch (response){
case MyOpenSpace.PostTo.Result.ERROR:
alert("Error");
break;
case MyOpenSpace.PostTo.Result.CANCELLED:
alert("Cancelled");
break;
case MyOpenSpace.PostTo.Result.SUCCESS:
alert("Success");
break;
}
}
var container = MyOpenSpace.MySpaceContainer.get();
var messageText = "My cool message";
var params = {};
params[MyOpenSpace.Message.Field.TITLE] = "title";
params[MyOpenSpace.Message.Field.TYPE] = MyOpenSpace.PostTo.Targets.COMMENTS; //This can be COMMENTS
//The recipient information can be retrieve using the REST API
var recipientId = friendID; //Set the id of the recipient
var recipientThumbnail = ""; //Set the url of the Thumbnail image
var recipientName = "umusix_dev";//Set the name of the recipient
var recipientProfileUrl = ""; // Set the url of the profile of the recipient
var message = container.newMessage(messageText, params);
// If not post back method is required you can set it to undefined.
container.postTo(message, postback, recipientId, recipientName, recipientThumbnail, recipientProfileUrl);
}