加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 使用$facebook-> api从页面删除Facebook帖子

发布时间:2020-12-13 17:22:29 所属栏目:PHP教程 来源:网络整理
导读:我无法从我的网络应用程序中删除Facebook帖子.现在我知道 Facebook documentation和其他SO帖子说这样做: You can delete objects in the graph by issuing HTTP DELETE requests to the object URLs,i.e,DELETE https://graph.facebook.com/ID?access_token
我无法从我的网络应用程序中删除Facebook帖子.现在我知道 Facebook documentation和其他SO帖子说这样做:

You can delete objects in the graph by issuing HTTP DELETE requests to 
the object URLs,i.e,DELETE https://graph.facebook.com/ID?access_token=... HTTP/1.1

但由于我是一个菜鸟,我不完全理解用HTTP请求删除的简短说明.因为当我尝试时它不起作用,我认为在上面的例子中简单地重定向到形成的url不会删除任何东西.这意味着我现在必须了解一些新的Web开发领域…… HTTP请求.

这些如何在PHP中完成? php manual也没有多大帮助.

附加信息:

我尝试了很多不同的变体:

$facebook->api($post_url,'DELETE',array('method'=> 'delete') );

我传递的网址是’/ post_id’. post_id在创建后捕获并存储到数据库中.此ID与$_GET [‘story_fbid’]匹配,可以在任何帖子固定链接上找到.也许这不是正确的身份证?我正在使用以下内容检索id:

//post to wall
$postResult = $facebook->api($post_url,'post',$msg_body );
//capture the id of the post
$this->fb_post_id = $postResult['id'];

当我运行上面的代码时,不会抛出任何错误.它被触摸是因为它运行后的诊断回声.

这些是我用$post_url传递给api的字符串的不同组合:

/postid                  api returns true,nothing is deleted from Facebook
/userid_postid           api returns false,Error: (#100) Invalid parameter
/postid_userid           api returns false,Error: (#1705) : Selected wall post for deletion does not exist
/accesstoken_postid      api returns false,Error: (#803) Some of the aliases you requested do not exist 
/postid_accestoken       api returns false,Error: (#803) Some of the aliases you requested do not exist

解决方法

更新的答案:

根据你的评论“这是一个页面”我看了Graph API’s Page的细节.如果我理解正确的详细信息,则Page Posts不支持删除.详细信息中的每个连接(事件,帖子,问题等)都有一个创建部分,如果连接支持删除,则它具有删除描述.帖子(提要)部分仅提及创建,而不是删除.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读