删除请求返回true,但请求仍然存在?

发布于 2025-01-04 00:27:07 字数 968 浏览 3 评论 0原文

可能的答案或错误:使用用户访问令牌似乎有效,它会删除请求,并在将来尝试读取它时抛出错误,但它仍然存在于图中,并且提供 apptoken 仍然会显示它,并且出于某种原因不会删除它。似乎与文档相反,但将 apptoken 更改为访问令牌似乎至少为我提供了解决方法。

首先,我正在使用的代码(因为文档中的代码总是返回用户类型消息不可见的实体)

function do_delete_request($url, $optional_headers = null) 
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//include array of additional headers
if (count($optional_headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $optional_headers);
}
return curl_exec($ch);
}
$full_request_id = build_full_request_id($request_id, $user_id);  
$delete_url = "https://graph.facebook.com/" .$full_request_id. "?access_token=".$apptoken;
$result = do_delete_request($delete_url);

如果这很混乱,我很抱歉,我不知道如何在这里格式化内容。经过大量谷歌搜索后我不知所措,我从不问这些东西。

$result 一遍又一遍地返回 true。图形浏览器显示请求仍然存在。

删除它是否意味着我将其从用户的请求界面中删除?或者我在删除过程中做错了什么?

我需要一种方法来判断请求是否已被接受。感谢您的任何帮助。

Possible answer or bug: Using the user access token seems to work, it deletes the request and will throw an error when trying to read it in the future, but it still exists in the graph and providing apptoken still shows it, and for some reason wouldn't delete it. Seems contrary to documentation, but changing apptoken to access token seemed to at least provide a workaround for me.

First, the code I'm using (as the one in the documentation always returned an entity not visible by user type message)

function do_delete_request($url, $optional_headers = null) 
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//include array of additional headers
if (count($optional_headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $optional_headers);
}
return curl_exec($ch);
}
$full_request_id = build_full_request_id($request_id, $user_id);  
$delete_url = "https://graph.facebook.com/" .$full_request_id. "?access_token=".$apptoken;
$result = do_delete_request($delete_url);

I'm sorry if that's messy, I don't know how to format stuff here. I'm at a loss after a lot of googling, I never ask this stuff.

$result returns true, over and over again. Graph explorer shows the request still exists.

By deleting it, does that just mean I remove it from the requests interface for a user? Or am I doing something wrong in my delete process?

I need a way to tell whether or not a request has been accepted already or not. Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懒的傷心 2025-01-11 00:27:07

Facebook 使用 URL 中的请求 ID 将用户发送到您的应用程序,这就是您判断请求何时已被接受的方式。由您来检查进程是否响应请求。

https://apps.facebook.com/[app_name]/?request_ids=[request_ids]

至于删除不起作用,一段时间后请求是否仍然存在? Facebook 和许多繁忙的网站都会进行大量缓存,因此删除等操作可能无法立即处理。

Facebook sends the user to your app with the Request ID(s) in the URL, that's how you tell when a request has been accepted. It's up to you to check for a process a response to a request.

https://apps.facebook.com/[app_name]/?request_ids=[request_ids]

As far as delete not working, is the request still their after some time? Facebook, and many busy sites, do heavy caching so things like delete may not be processed immediately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文