Facebook stream.publish and legacy template packages?

I have not tried communicating with the PHP facebook API for several months. Since the template packages apparently don't work now, how can I post a story in the news feed for my friends? I also already requested permission.

Edit: The problem arises because the requested permissions are not set for the user when they are granted.

While I have it

$appapikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$appsecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$facebook = new Facebook($appapikey, $appsecret);
$fb_user = $facebook->require_login();

try {
    $facebook->api_client->feed_publishUserAction();
} catch(Exception $e) { }

Edit: I looked at the "api documentation" framework several times, it just is not clear to me. I can’t say what is really outdated or not. They refer to textbooks for 2-3 years!

If you have a problem reloading the iframe application again and again, try using

$facebook->require_frame()
+3
2

wiki facebook? http://wiki.developers.facebook.com/index.php/Stream.publish

, . , .

EDIT: , ( )

function check_perms() {

    global $facebook, $uid;

    $data = $facebook->api_client->fql_query( "SELECT uid, publish_stream FROM permissions WHERE uid = " . $uid );
    if( $data[0]['publish_stream'] != true ) {
        echo '<br /><p>No \'publish_stream\' permissons found!<br />';
        echo '<fb:prompt-permission perms="publish_stream"> Allow me to publish to your wall (*click*) </fb:prompt-permission>';
        echo '<br />You\'ll have to refresh the page to continue.</p>';
        die();
    }

}
+1
    <?php
          $message ="Your Message";
           $attachment = array( 
            'name' => 'Application Name or message', 
            'href' => 'http://apps.facebook.com/tshirtquote', 
            'description' => 'Choose/Write your T-shirt Quote, Get A Tshirt Free printed with your Favorite Quote',
            'media' => array(array('type' => 'image', 'src' => 'http://linkdoo.com/tshirtquote/images/tshirt1.JPG', 'href' => 'http://apps.facebook.com/tshirtquote/')), 
            ); 
           $action_links = array( array('text' => 'WriteYourTShirtQuote', 'href' =>   'http://apps.facebook.com/tshirtquote')); 
           $attachment = json_encode($attachment); 
           $action_links = json_encode($action_links);
           $message = json_encode($message);
      ?>
     <script>
     var attachment = <?= $attachment ?>;
     var message = <?= $message ?>;
     var action_links = <?= $action_links ?>;
     Facebook.streamPublish(message,attachment,action_links);

     </script>

script,

+1

Source: https://habr.com/ru/post/1729732/


All Articles