通过 api (me/links) 共享链接不使用提供的图片、标题和描述

发布于 2024-12-08 18:44:50 字数 766 浏览 0 评论 0原文

我试图通过 /me/links 共享链接,而“me”被验证为 Facebook 页面。文档说,我可以为它提供“图片”、“标题”和“描述”,但这似乎不起作用,因为 facebook 尝试从页面接收该信息,例如 opengraph 标签等。

即使该网站不这样做不提供任何信息,Facebook 不使用此处。值得一提的是:Facebook 的普通链接共享功能本身也以同样的方式运行得很糟糕(这就是为什么我希望这是一个错误)。

代码非常简单:

<?php
$data = array(
  'message' => $text,
  'picture' => $pic,
  'name' => $name,
  'link' => $link,
  'caption' => $caption,
  'description' => $description
);
$result = $fb->api('/me/links','POST',$data);
?>

如果我在 /me/feed 上执行非常相同,facebook 不会忽略这些字段,一切看起来都很好,但它不会在用户提要中显示帖子(自九月份的最新更改以来),这是毫无价值的,并且它没有在帖子底部提供共享链接。

如果这是一个错误或意图,您有什么想法吗?我使用的是 PHP SDK 3.0.1。

I'm trying to share links via /me/links, while "me" is authenticated as a facebook page. The documentation says, I can provide it with "picture", "caption" and "description", but that doesn't seem to work, since facebook tries to receive that information from the page e.g. opengraph tags etc.

Even if the site doesn't provide any info, facebook doesn't use the fields that are documentet here. And to have it mentioned: The plain link sharing function at facebook itself works crappy in the very same way (that's why I'm hoping it's a bug).

The Code is very simple:

<?php
$data = array(
  'message' => $text,
  'picture' => $pic,
  'name' => $name,
  'link' => $link,
  'caption' => $caption,
  'description' => $description
);
$result = $fb->api('/me/links','POST',$data);
?>

If I do the very same over /me/feed, facebook doesn't ignore the fields and everything looks fine, but it doesn't show the post in a users feed (since the most recent changes in september), which is worthless and it doesn't provide a share link at the bottom of the post.

Any ideas if this is a bug or intention? I'm using the PHP SDK 3.0.1.

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

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

发布评论

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

评论(2

养猫人 2024-12-15 18:44:50

这是设计使然。

当您将链接发布到 /me/links 时,流故事会从提供的 URL 中的 OG 标签获取数据。

This is by design.

When you post a link to /me/links, the stream story takes it's data from the OG tags in the URL supplied.

囍笑 2024-12-15 18:44:50

您发布的链接上的 HTML 应该如下所示:

<head>
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="name for ENTIRE SITE"/>
    <meta property="og:title" content="name of PAGE"/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content="<URL HERE>"/>
    <meta property="og:description" content="my description" />
    <title>Untitled</title>
</head>

@Simon - 这仍然没有回答“标题”属性来自何处的问题......

here's what the HTML on the link you post should look like:

<head>
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="name for ENTIRE SITE"/>
    <meta property="og:title" content="name of PAGE"/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content="<URL HERE>"/>
    <meta property="og:description" content="my description" />
    <title>Untitled</title>
</head>

@Simon - this still doesnt answer the question of where the "caption" property comes from...

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