1

news.reads アクションを介してアクションを公開しようとしていますが、行き詰まりました。

$facebook->api を送信した後、この行の後に応答がないなどの「終了」をスローするのが好きです。

コード:

    <?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="he-IL">
    <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# 
                  article: http://ogp.me/ns/article#">
     <meta property="og:type" content="article" /> 
  <meta property="fb:app_id" content="306597542762982" /> 
  <meta property="og:url"    content="http://v2.raal.co.il/index.php" /> 
  <meta property="og:title"  content="הצצה נדירה: יחידת אגוז, קומנדו היבשה של צהל" /> 
  <meta property="og:description" content="יחידת אגוז התאמנה השבוע באחד המתארים הקשים ביותר, מתאר ה..." /> 

     <meta property="og:site_name"            content="פורטל רעל">

     <meta property="article:published_time"  content="DateTime"> 
     <meta property="article:modified_time"   content="DateTime"> 
     <meta property="article:expiration_time" content="DateTime">
     <meta property="article:author"          content="URL to Author object">
     <meta property="article:section"         content="Section of article">
     <meta property="article:tag"             content="Keyword">
 </head>

    <body>


<?Php
//uses the PHP SDK.  Download from https://github.com/facebook/php-sdk
require 'src/facebook.php';


$facebook = new Facebook(array(
  'appId'  => '306597542762982',
  'secret' => '88XX7f1',
));


$user = $facebook->getUser();
if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

if (!$user) {
  $loginUrl = $facebook->getLoginUrl();
  header("Location: " . $loginUrl);
}
    //echo "<script type='text/javascript'>top.location.href = '$url';</script>";




$params = array (
  'article' => 'http://v2.raal.co.il/',
  'access_token' => $facebook->getAccessToken()
);



$out = $facebook->api( '/me/news.reads','post', $params);
var_dump($out);


   ?>

  </body>
</html>

応答が返ってきます: 1 2 (print 1; print 2;)

一方、print_r($out) は null を返します。

4

1 に答える 1

4

最初: 記事のスペルが間違っています (artice)、確認しましたか?

2 番目: 公開しようとしている URL は記事ではありません。ここに og:tags を追加する必要があります。

3 番目: publish_stream 権限はありますか?

Graph API Explorerを使用して出力を確認できますか?

于 2012-09-30T13:43:42.500 に答える