简体   繁体   English

无法通过图形API发布

[英]unable to post via graph api

I cannot understand what is the problem in my code. 我无法理解代码中的问题。 I have 'publish_stream' in my scope. 我的范围内有“ publish_stream”。 The user has authenticated my app with all the permissions, but still this error shows up. 用户已使用所有权限对我的应用程序进行了身份验证,但仍然显示此错误。

The folllowing is my code to post via the graph api :- 以下是我的要通过图形API发布的代码:-

<?php
    try{
        $publishStream = $facebook->api("/$user/feed", 'post', array(
            'message'       => 'TESTING...',
            'link'          => 'http://example.com',
            'picture'       => 'http://example.com/image.png',
            'name'          => 'example name!',
            'caption'       => 'example caption',
            'description'       => 'PHP SDK ROCKS!',
            ));
echo "IN TRY BLOCK ";
    }catch(FacebookApiException $e){
        error_log($e);
echo "IN CATCH BLOCK ";
    }

?>

The output for the given code is :- IN CATCH BLOCK. 给定代码的输出是:IN CATCH BLOCK。 Please tell me where am I wrong... 请告诉我我哪里错了...

基于Facebook Graph API文档:1)检查$ user变量,以确保确实包含(干净的)Profile_ID,2)您需要对目标配置文件具有“发布权限”,请参阅: http : //developers.facebook.com/ docs / concepts / login / permissions-login-dialog /#publishing-permissions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM