duanpai9945 2011-04-29 04:30
浏览 72
已采纳

Facebook错误验证访问令牌:会话已在unix时间到期

I have integrated the offline wall posting for the users of my website who have linked their FB accounts with there user details. I have stored there FB-id, FB-Access token in my database and by using the PHP-SDK libraries I had integrated the feed wall posting in the website. Everything worked very well with all users getting the messages on there facebook wall. But today all the things went in vain as it throws various kinds of error. I have been searching for more documents but can't find the exact relevant solution for this issues.

Lines of code i have used for FB-Wall Posting

             $usid=$pageinfo['user']['id_facebook'];
    $accestoken=$pageinfo['user']["facebook_accesstoken"];

        if($pageinfo['user']['user_fbtoken']=='1')

         $attachment =  array(
        'access_token' => $accestoken,
        'message' => "myTaste || real restaurant reviews, share your taste on myTaste",
        'name' => "My Favorite Restaurant is ".$business['name'].$business['location']['city']."-What is yours? ",
        'link' => $business['personal_url'],
        'description' => "", 
        'picture'=> "http://googima.com/images/mysite.gif"
        );  

        $facebook->api("/".$usid."/feed", "post",$attachment); 
    }

Error messages:

 Uncaught OAuthException: Error validating access token: Session has expired at unix time

 Uncaught OAuthException: (#210) User not visible thrown in /hsphere/local/home/mysite.com/include/3rdparty/facebook-php-sdk/src/facebook.php

The main idea of doing this offline wall posting is user is not going to asked for the FB login each time when do some reviews in the website. It need to post automatically by using the FB details that we have stored in the user table.

  • 写回答

2条回答 默认 最新

  • doujiu5464 2011-04-29 13:47
    关注

    Once you grant the publish_stream permission, no need for the access_token. So removing it and using something like this would work even without a valid session (just an example):

    $params =  array(
        'message' => "Test Message",
        'picture'=> "http://path/to/image.jpg"
    );  
    $post_id = $facebook->api("/$uid/feed", "post",$params);
    

    For more information refer to this answer (EDIT 4). Kudos to @zerkms for this info btw!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable