Facebook API - 删除状态 [英] Facebook API - delete status

查看:146
本文介绍了Facebook API - 删除状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中,我使用curl发送删除到fb图api - 但是我得到以下错误;

In PHP, I'm using curl to send a delete to the fb graph api - and yet I'm getting the following error;

{"error":{"type":"GraphMethodException","message":"Unsupported delete request."}}

我使用的代码是:

$ch = curl_init("https://graph.facebook.com/" . $status_id . ""); 
curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);  
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_CAINFO, NULL); 
curl_setopt($ch, CURLOPT_CAPATH, NULL); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); 

$result = curl_exec($ch); 
echo $result;

$ query包含访问令牌。

$query contains the access token.

推荐答案

修复!

在删除时,必须在对象ID前添加userid:

You have to prepend the userid to the object ID when deleting:

删除 https://graph.facebook.com/673509687_104812882909249?access_token= {access_token}
其中
673509687是我的用户ID,104812882909249是objectID

DELETE https://graph.facebook.com/673509687_104812882909249?access_token={access_token} where 673509687 is my userID and 104812882909249 is the objectID

这篇关于Facebook API - 删除状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆