tags:

views:

518

answers:

3

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php

include_once './facebook-platform/php/facebook.php';
$facebook = new Facebook(my api keys go here);
$fb_user = $facebook->require_login();
/*this is where i want it to go */
$facebook->api_client->stream_publish("test");

How would I go about doing this?

+3  A: 

You can't call it in PHP, since it's a Javascript function.

You can't trigger the browser to change the DOM from a server-side language.

BraedenP
http://wiki.developers.facebook.com/index.php/Extended_permissions contains all the ways of granting extended permissions and indeed they are all client-side. One could imagine some serverside-triggered way of granting them via a redirect to Facebook and then a redirect back to the app site to trigger a success/failure response but they haven't implemented this and there isn't much reason to given how much work they've put into the Javascript API.
Ben
If i get extended permissions granted via javascript, can I then use those permissions with PHP?
You can use the permissions to perform server-side functions, but there's still no way to trigger Javascript events from PHP, unless you inject a <script> tag into the page which will run automatically after the onload event.
BraedenP
A: 

If you have the permission the post action is something "invisible", if you don't have the permission then you have to pop up the Facebook dialog and ask for that permission (but you have to use also javascript and not only php).

Here is a tutorial that explains how to post to your wall:

http://www.barattalo.it/2010/01/17/posting-to-facebook-from-website-with-facebook-connect/

Pons
+1  A: 

$userId = $facebook->require_login($required_permissions = 'publish_stream');

should do the job

RenoRosco