我在运行包含长用户 ID 的 Facebook FQL 查询时遇到问题

发布于 2025-01-06 23:28:03 字数 546 浏览 0 评论 0原文

我在使用 FQL 运行包含提供的“大”(以 10000 开头......)用户 ID 的查询时遇到问题,

这里是一个不起作用的示例:

fql?q=SELECT uid, first_name,last_name,pic,pic_square,name 
        FROM user 
        WHERE uid=100002445083370

是否有一种方法可以封装长数字,以便将其作为字符串传递?

这是另一个例子:

/fql?q=SELECT src_big 
    FROM photo 
    WHERE aid IN (SELECT aid 
                    FROM album 
                    WHERE  owner=100002445083370 AND type="profile") 
    ORDER BY created DESC LIMIT 1

有人能够解决这个问题吗?我正在图形浏览器中测试查询,但也没有运气。

I am having problems running queries with FQL that include a supplied "Large"(beginning with 10000..) User ID

here is an example of one that is not working:

fql?q=SELECT uid, first_name,last_name,pic,pic_square,name 
        FROM user 
        WHERE uid=100002445083370

Is there a way to encapsulate the long number so it's passed as a string?

here is another example:

/fql?q=SELECT src_big 
    FROM photo 
    WHERE aid IN (SELECT aid 
                    FROM album 
                    WHERE  owner=100002445083370 AND type="profile") 
    ORDER BY created DESC LIMIT 1

Has anyone been able to solve this issue? I am testing the queries in the graph explorer with no luck as well.

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

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

发布评论

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

评论(2

彼岸花ソ最美的依靠 2025-01-13 23:28:03

我明白问题是什么,

我试图传递的用户 ID 应该是:“100002445083367”,但是通过查询朋友列表并获取他们的用户 ID,我得到了“uid”:1.0000244508337e+14被缩短为:100002445083370(php删除e+14)关闭第二个查询。当我从 PHP 和 Javascript 来回传递它时,我需要确保我获取的 id 保持为字符串值而不是数字。

问题是由 PHP 处理 JSON_DECODE 的方式引起的。我必须修改 Facebook PHP SDK 并在 json_decode 之前添加 preg_replace。它将确保 json_decode 不会通过首先将大整数转换为字符串来将它们转换为浮点数。

这是代码:
来自 base_facebook.php 的第 803 行:

$result = json_decode(preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $this->_oauthRequest($this->getUrl($domainKey, $path),$params)), true);

以下是有关该主题的更多信息:
http://forum.developers.facebook.net/viewtopic.php?id=20846

I see what the problem is,

The User id I am trying to pass is supposed to be: "100002445083367", but from querying the list of friends and grabbing their User Id, I am getting back "uid":1.0000244508337e+14 which is being shortened to: 100002445083370 (php removing the e+14) throwing off the second query. I need to make sure the id I am grabbing is staying as a string value not a number while I pass it back and forth from PHP and Javascript.

The problem is because of the way PHP handles JSON_DECODE. I had to modify Facebook PHP SDK and add a preg_replace previous to the json_decode. It will make sure json_decode doesn't convert large integers to floats by first converting them to strings.

here is the code:
line 803 from base_facebook.php:

$result = json_decode(preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $this->_oauthRequest($this->getUrl($domainKey, $path),$params)), true);

here is more information on the subject:
http://forum.developers.facebook.net/viewtopic.php?id=20846

自此以后,行同陌路 2025-01-13 23:28:03

“不工作”是什么意思?
该查询在 Graph API 资源管理器中适用于我,但响应是

{
  "data": [
  ]
}

我认为用户 ID 无效; https://www.facebook.com/profile.php?id=100002445083370给我一个“页面未找到”错误。

What do you mean by "not working"?
That query works for me in Graph API explorer but the response is

{
  "data": [
  ]
}

I think that user-id isn't valid; https://www.facebook.com/profile.php?id=100002445083370 gives a "Page not found" error for me.

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