【问题标题】:PHP: Post image -link only- into Facebook wallPHP:将图片 - 仅链接 - 发布到 Facebook 墙上
【发布时间】:2012-05-14 20:45:09
【问题描述】:

我正在尝试使用 PHP 在 Facebook 墙上发帖。我找到了这段代码:

$args = array(
    'message' => $text,
    'picture' => $link2picture
);

$this->_facebook->api('/me/feed/', 'post', $args);

但它似乎不起作用(它只显示消息文本)。所以我的问题是,有没有办法只发布图片,将其链接到页面?我试图避免将照片上传到 Facebook,而且我不想使用显示与左侧对齐的小图片的标准“共享链接”;我的想法只是显示图像缩略图,可能是图像之前或之后的描述,当用户单击该图像时,他将被重定向到给定页面。这可以做到吗?怎么样?

编辑:我也试过这段代码,但没有成功:

$attachment = array(
'name' => $title,
'caption' => 'The subtitle',
'description' => $message,
'media' => array(array(
    'type' => 'image',
    'src' => $file_path,
    'href' => $link
))
);
$this->facebook->api(array('method' => 'stream.publish', 'target_id' => $this->getUser(), 'attachment' => $attachment));

【问题讨论】:

    标签: php facebook image facebook-wall


    【解决方案1】:

    试试这个:

    $attachment = array('message' => $message, 'access_token' => $token, 'picture' => $picture_path); $result = $facebook->api('/me/feed', 'post', $attachment);

    享受:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-29
      • 2011-07-05
      • 2011-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多