Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将链接发布到未显示的页面?_Php_Facebook_Facebook Php Sdk_Facebook Page - Fatal编程技术网

Php 将链接发布到未显示的页面?

Php 将链接发布到未显示的页面?,php,facebook,facebook-php-sdk,facebook-page,Php,Facebook,Facebook Php Sdk,Facebook Page,我可以看到上面写着“所有的朋友”——这可能是导致帖子无法显示的原因吗?你不能用网页做朋友,是吗 我现在已将“data”变量修改为以下内容: { "id": "484729401573953", "created_time": "2013-01-08T12:03:27+0000", "caption": "www.readesresidential.com", "description": "test_description", "from": { "name": "

我可以看到上面写着“所有的朋友”——这可能是导致帖子无法显示的原因吗?你不能用网页做朋友,是吗


我现在已将“data”变量修改为以下内容:

{
  "id": "484729401573953",
  "created_time": "2013-01-08T12:03:27+0000",
  "caption": "www.readesresidential.com",
  "description": "test_description",
  "from": {
    "name": "David Reade",
    "id": "100003544363105"
  },
  "icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
  "link": "http://www.readesresidential.com/brookside-crescent-northop-hall-ch7-6hw-ps03009/",
  "message": "test_message",
  "name": "test_name",
  "picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQC7MpbP6aNe2CVP&w=90&h=90&url=http%3A%2F%2Fwww.readesresidential.com%2Fframework%2Fstatic-487d%2F2%2Fimg%2Fv3%2Ffacebook.png",
  "privacy": {
    "description": "Friends",
    "value": "ALL_FRIENDS",
    "allow": "",
    "deny": "",
    "networks": "",
    "friends": ""
  }
}
Graph API explorer的响应为:

$data   =   array(
    'access_token'  => $token,
    'description'   => 'test_description',
    'link'          => 'http://www.readesresidential.com/go/ps02618',
    'message'       => 'test_message',
    'name'          => 'test_name',
    'privacy'       => array(
        'value'   => 'EVERYONE'
    )
);
尽管这篇文章现在是“公开的”,我使用了一个全新的URL,但它仍然没有显示出来

这可能是Facebook的bug吗

为什么“link”值会导致返回一个ID而不显示post


如果同一个用户再次发布同一个链接,通常会发生这种情况(两次发布之间只有一定的时间)。

在修改代码后,我发现了如何修复这种情况。事实证明,我使用的访问令牌是不正确的,即使调试器工具说它是有效的,并且具有适当的权限

我必须使用返回页面信息的访问令牌和一个完全不同的访问令牌来查询Graph API,特别是/me/accounts位。这个有问题的访问令牌没有过期时间(我以为这个功能已经没有了???),在将它插入到我的代码中之后,帖子现在可以正确地显示给所有用户


这些步骤都没有出现在Facebook的文档中,如果有,那么很难找到。

尝试使用API explorer发布。并在这里更新你所得到的
$data   =   array(
    'access_token'  => $token,
    'description'   => 'test_description',
    'link'          => 'http://www.readesresidential.com/go/ps02618',
    'message'       => 'test_message',
    'name'          => 'test_name',
    'privacy'       => array(
        'value'   => 'EVERYONE'
    )
);
{
  "id": "454654274601000",
  "created_time": "2013-01-08T12:14:52+0000",
  "caption": "www.readesresidential.com",
  "description": "test_description",
  "from": {
    "name": "David Reade",
    "id": "100003544363105"
  },
  "icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
  "link": "http://www.readesresidential.com/church-street-tarvin-ch3-8eb-ps02618/",
  "message": "test_message",
  "name": "test_name",
  "picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQC7MpbP6aNe2CVP&w=90&h=90&url=http%3A%2F%2Fwww.readesresidential.com%2Fframework%2Fstatic-487d%2F2%2Fimg%2Fv3%2Ffacebook.png",
  "privacy": {
    "description": "Public",
    "value": "EVERYONE",
    "allow": "",
    "deny": "",
    "networks": "",
    "friends": ""
  }
}