在墙上发送通知或发布

时间:2010-08-01 07:42:42

标签: facebook facebook-wall

我一直在疯狂,无法弄清楚如何为我的应用程序制作一个脚本,允许用户选择一个朋友,并在我的应用程序中向他们发送通知或帖子。

我只需要通知他们的朋友他们一直在挑战玩Flash游戏,只是带有链接的简单文字,我不需要任何花哨的东西:D

这是我尝试过的,它不起作用:(不知道为什么。

$message = 'Watch this video!';
 $attachment = array( 'name' => 'ninja cat', 'href' => 'http://www.youtube.com/watch?v=muLIPWjks_M', 'caption' => '{*actor*} uploaded a video to www.youtube.com', 'description' => 'a sneaky cat', 'properties' => array('category' => array( 'text' => 'pets', 'href' => 'http://www.youtube.com/browse?s=mp&t=t&c=15'), 'ratings' => '5 stars'), 'media' => array(array('type' => 'flash', 'swfsrc' => 'http://www.youtube.com/v/fzzjgBAaWZw&hl=en&fs=1', 'imgsrc' => 'http://img.youtube.com/vi/muLIPWjks_M/default.jpg?h=100&w=200&sigh=__wsYqEz4uZUOvBIb8g-wljxpfc3Q=', 'width' => '100', 'height' => '80', 'expanded_width' => '160', 'expanded_height' => '120')));
 $action_links = array( array('text' => 'Upload a video', 'href' => 'http://www.youtube.com/my_videos_upload'));
 $target_id = $user;
 $facebook->api_client->stream_publish($message, $attachment, $action_links, $target_id);

更新 appinclude.php

$facebook->redirect('https://graph.facebook.com/oauth/authorize?client_id=132611566776827&redirect_uri=https://apps.facebook.com/gamesorbiter/&scope=publish_stream');

我得到的错误:

{
   "error": {
      "type": "OAuthException",
      "message": "Invalid redirect_uri: The Facebook Connect cross-domain receiver URL (https://apps.facebook.com/gamesorbiter/) must be in the same domain or be in a subdomain of an application's base domain (gamesorbiter.com).  You can configure the base domain in the application's settings."
   }
}

如果没有额外的“s”(http),我会收到此错误:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

请你发表一个例子。 我还需要扩展权限才能这样做,或者如果用户发送了我不需要的消息吗?

谢谢

1 个答案:

答案 0 :(得分:0)

  

我还需要获得扩展许可   这样做或如果用户发送   消息我不是吗?

是的,您需要获得用户的offline_access and publish_stream扩展权限。

<强>更新

appinclude.php 文件中,输入如下代码:

$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();

$facebook->redirect('https://graph.facebook.com/oauth/authorize?
client_id=[YOUR APP ID]&
redirect_uri=[YOUR APP URL]&
scope=publish_stream, offline_access');

[YOUR APP ID]替换为您可以在Facebook开发者部分中创建网站的应用程序设置中看到的应用程序ID。同时将[YOUR APP URL]替换为您的应用网址。