[ANS] stream_publish fbml canvas

Translate Request has too much data
Parameter name: request
Translate Request has too much data
Parameter name: request

hathingaMemberRegistered: 2009-09-09Posts: 55

hello guys, it's driving me crazy...

so i have a fbml canvas

function publishPost(){
//new
$userinfo = $facebook->api_client->users_getInfo(array($user_id), array('first_name', 'last_name'));
$name = $userinfo[0]['first_name'].' '.$userinfo[0]['last_name'];

$message = me me me!';
$attachment = array('name' => ''. "$name"  .'','href' => 'http://apps.facebook.com/app/','description' => 'An akon baton: ','media' => array(array('type' => 'image','src' => 'link to img with full url','href' => 'http://apps.facebook.com/app/')));
$action_links = array(array('text' => 'this is text','href' => 'http://apps.facebook.com/app/'));

$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
$facebook->api_client->stream_publish($message, $attachment, $action_links);

//end new

}

and i have a button

and the page keeps having the error icon at status bar (probably come from js script) and i dont see any feed form..

Last edited by hathinga (2009-11-13 00:12:27)

The ReaperMemberRegistered: 2009-07-12Posts: 1249

you're getting an error because you're trying to use php code in javascript...which won't work.

Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.hathingaMemberRegistered: 2009-09-09Posts: 55

oh... gosh... they just throw the code without implementation instruction. should i include after $facebook->api_client->stream_publish($message, $attachment, $action_links);?

I suppose we are using javascript to create the action... or jump to new page with that php code...

Last edited by hathinga (2009-11-13 00:11:49)

The ReaperMemberRegistered: 2009-07-12Posts: 1249Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.hathingaMemberRegistered: 2009-09-09Posts: 55

just to check my logic..:
   1st link: Stream.publish -> used php code so i must call another page to be able to publish to user stream (i need to publish on the same page, user doesnt need to go to another page)
   2nd link: for iframe -> i use FBML...
   3rd link-> FBJS, most promising (it can be used in FBML app right?), however, still not working...:

seem like the - keep being changed to _

FendyBt2MemberFrom: MalaysiaRegistered: 2009-11-05Posts: 221Website

hello guys, it's driving me crazy...

so i have a fbml canvas

function publishPost(){
//new
$userinfo = $facebook->api_client->users_getInfo(array($user_id), array('first_name', 'last_name'));
$name = $userinfo[0]['first_name'].' '.$userinfo[0]['last_name'];

$message = me me me!';
$attachment = array('name' => ''. "$name"  .'','href' => 'http://apps.facebook.com/app/','description' => 'An akon baton: ','media' => array(array('type' => 'image','src' => 'link to img with full url','href' => 'http://apps.facebook.com/app/')));
$action_links = array(array('text' => 'this is text','href' => 'http://apps.facebook.com/app/'));

$attachment = json_encode($attachment);
$action_links = json_encode($action_links);
$facebook->api_client->stream_publish($message, $attachment, $action_links);

//end new

}

and i have a button

and the page keeps having the error icon at status bar (probably come from js script) and i dont see any feed form..

Try this...

Hope this works... double check the code, maybe I missed something... ;-)

EDIT: forgot the ";" after return false

Another EDIT: I've tested this code and it works! Your app must have the stream publish permission for this to work and it will not pop up any form feed...

Last edited by FendyBt2 (2009-11-13 04:07:16)

* My apps: Applications Junkie
* My apps for sale: View!
* Applications using my apps: View!The ReaperMemberRegistered: 2009-07-12Posts: 1249

@FendyBt2, the code was already redundant...it's php, and he's trying to use javascript.

@hathinga
you are correct about the first link, but not 2 and 3. link 2 is for FBML apps, and link 3 is for iframe/connect apps.
also, if you're going to pop the feed form with Facebook.streamPublish/FB.Connect.streamPublish, you don't need to worry about permissions.

Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.FendyBt2MemberFrom: MalaysiaRegistered: 2009-11-05Posts: 221Website

@FendyBt2, the code was already redundant...it's php, and he's trying to use javascript.

@hathinga
you are correct about the first link, but not 2 and 3. link 2 is for FBML apps, and link 3 is for iframe/connect apps.
also, if you're going to pop the feed form with Facebook.streamPublish/FB.Connect.streamPublish, you don't need to worry about permissions.

I've edited the code to make it work with both javascipt and php... :-)

* My apps: Applications Junkie
* My apps for sale: View!
* Applications using my apps: View!The ReaperMemberRegistered: 2009-07-12Posts: 1249

no you didn't. you just added php tags around it, so all it would do is run the php server side (get a permission error) and have a blank function in javascript.

Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.FendyBt2MemberFrom: MalaysiaRegistered: 2009-11-05Posts: 221Website

no you didn't. you just added php tags around it, so all it would do is run the php server side (get a permission error) and have a blank function in javascript.

I've tested it with my apps that have a publish_stream permission and it works... but it didn't pop up any feed form... but still, it published the feed to my wall...

And here's the code that pops up a feed form...

* My apps: Applications Junkie
* My apps for sale: View!
* Applications using my apps: View!The ReaperMemberRegistered: 2009-07-12Posts: 1249

it didn't pop a feed form because it's not using any client side (javascript) code. only php, which is executed server side. you aren't getting permission errors because you've already given your app permission.

Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.hathingaMemberRegistered: 2009-09-09Posts: 55

@The Reaper: "with Facebook.streamPublish/FB.Connect.streamPublish, you don't need to worry about permissions" -> this method would probably better since it doesnt need permission. However, it's server side script, if i dont load other page, how can i call the feed form?? If i use fb:iframe to load another page without direct away from current page, the variable (you know the ?pp=aa or $_POST variable) cant get to iframe...

Last edited by hathinga (2009-11-13 05:15:56)

The ReaperMemberRegistered: 2009-07-12Posts: 1249

Facebook.streamPublish and FB.Connect.streamPublish are client side code. as your app is FBML, you'll use Facebook.streamPublish.
a code example is the second one shown by FendyBt2:

this code will work for you.

Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.hathingaMemberRegistered: 2009-09-09Posts: 55

thank you very much!!!! i over looked the part where we can just the variables

ozgur.tugrulNew MemberRegistered: 2010-10-29Posts: 10

i didn't understand this part ..

var attachment = ;
var action_links = ;

what kind of syntax is this ?

please give me more explanation .. i'm quite newbie about this area ..

The ReaperMemberRegistered: 2009-07-12Posts: 1249

@ozgur.tugrul

is the short tag equivilent of

Don't Fear The Reaper
Need help debugging with the JS library? Try Here! [App Profile] - Will be transitioning to the new SDK.chiefsabMemberFrom: PakistanRegistered: 2009-10-11Posts: 140Website

hello how to make this publish on page wall also means i wan to publish on profile page and application page simultaneously?

chrisley5New MemberRegistered: 2011-07-27Posts: 3

I suppose we are using javascript to create the action... or jump to new page with that php code..

williamksNew MemberRegistered: 2011-08-02Posts: 2

i want to publish a text feed from the user input without the facebook frame??? how can i do that? on the user wall thanks for help smile

Last edited by williamks (Today 11:35:43)