1

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

我只需要通知他们的朋友他们已经被挑战玩 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.

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

谢谢你

4

1 回答 1

0

我是否还需要扩展权限才能做到这一点,或者用户是否发送了我不需要的消息?

是的,您需要用户的offline_access 和 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]用您的应用程序网址替换。

于 2010-08-01T07:47:33.310 回答