【问题标题】:facebook: wrong link gets posted to wall with php-sdkfacebook:使用 php-sdk 将错误的链接发布到墙上
【发布时间】:2014-08-04 13:01:38
【问题描述】:

我有一个带有 fangate 的页面标签。 在这个 fangate 上,用户可以点击分享一个链接。 这是通过 php sdk 完成的,如下所示:

$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
  'cookie' => true,
));
$message = "Win great prices!";
$wallpost = array(
'message' => $message,
'name' => 'Win Prices',
'link' => 'https://someurl.com/launcher.php',
'description' =>'I took the survey!',
'picture' => 'http://www.someurl.com/images/logo.png'
);

try
{
    $facebook->api('/me/feed/','post',$wallpost);
    }
    catch(Exception $e)
    {
   //
    }

launcher.php 仅包含使用“?ref=ts”转发到页面选项卡,以使其可用于移动浏览器,例如:

<?php
header('Location: ' . "https://www.facebook.com/myGreatPage?sk=app_45532543674737&ref=ts");
?>

但是: 发布的链接是不是 https://someurl.com/launcher.php,而是指向页面标签https://www.facebook.com/myGreatPage?sk=app_45532543674737 的链接,如果他们点击它,它不适用于移动设备。 facebook 似乎会自动过滤/更改链接。 我能做些什么?我错过了什么吗?

【问题讨论】:

    标签: php facebook facebook-graph-api mobile


    【解决方案1】:

    好的,现在我知道我的错了。 它不是包含链接的“链接”字段。 它的论点

    'actions' => json_encode(array('name' => 'Vote for your team','link' => 'https://blimfb.de/golfclub/app2launcher/index.php'))
    

    那是缺失的。 所以我的数组必须看起来像

    $wallpost = array(
    'message' => $message,
    'name' => 'Win Prices',
    'link' => 'https://someurl.com/launcher.php',
    'description' =>'I took the survey!',
    'picture' => 'http://www.someurl.com/images/logo.png',
    'actions' => json_encode(array('name' => 'I took the survey!','link' => 'https://someurl.com/launcher.php'))
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-07
      • 2012-01-12
      • 2011-10-30
      相关资源
      最近更新 更多