dongpan2788 2012-09-25 17:30
浏览 74

news.reads php sdk在facebook上 - 无法发布

I'm trying to publish an action via news.reads action, but I got stuck.

after sending $facebook->api - it likes throw me an "exit" like, no response after this line.

the code:

    <?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>

I get in response : 1 2 (print 1; print 2;)

while print_r($out) returns me null.

  • 写回答

1条回答 默认 最新

  • duanhuiuw12555 2012-09-30 13:43
    关注

    First: Article is misspelled (artice), did you check that ?

    Second: The url you are trying to publish is not an article, you have to add the og:tags in it, look at here.

    Third: Do you have publish_stream permissions ?

    Can you check the output using Graph API Explorer?

    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值