我试图通过 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(打印 1;打印 2;)
而 print_r($out) 则返回 null。