2

我已将以下代码添加到“正文”部分:

<?php
  require "php-sdk/facebook.php";
  $facebook = new Facebook(array(
    'appId'=>'xxxxxxxxx',
    'secret'=>'xxxxxxxxxxxxxxxxx',
    'cookie'=>true
  ));
  if(!$facebook->getUser()) {
    $url = $facebook->getLoginUrl(array('scope'=>'publish_actions'));
    echo "<script> top.location=\"".$url."\"; </script>";
    exit(0);
  }
  $params = array('photo'=>'' . site_url( $this->uri->uri_string() ) . '',
      'access_token'=>$facebook->getAccessToken());
  $out = $facebook->api('/me/marcellusmusic:love','post',$params);
  print_r($out);
?>

我收到以下错误:

Uncaught OAuthException:
  Unknown path components:
    /app_marcellusmusic:love thrown in /home/content/88/4739388/html/php-sdk/base_facebook.php on line 1238'

有什么建议吗?

4

1 回答 1

0

什么是marcellusmusic:love

也许你应该像这样使用它:

<?php
  require "php-sdk/facebook.php";
  $facebook = new Facebook(array(
    'appId'=>'xxxxxxxxx',
    'secret'=>'xxxxxxxxxxxxxxxxx',
    'cookie'=>true
  ));
  if(!$facebook->getUser()) {
    $url = $facebook->getLoginUrl(array('scope'=>'publish_actions'));
    echo "<script> top.location=\"".$url."\"; </script>";
    exit(0);
  }
  $params = array('photo'=>'' . site_url( $this->uri->uri_string() ) . '',
      'access_token'=>$facebook->getAccessToken());
  $out = $facebook->api('/me/feed','post',$params);
  print_r($out);
?>

我只更改了api路径。

于 2013-07-25T17:11:29.660 回答