我正在尝试通过 php-dsk graph API 发布链接。当我在http://developers.facebook.com/tools/debug输入我的 URL 时,它成功显示响应代码 - 200。但是当我尝试发布到 facebook 墙的链接时,出现以下错误:-
Fatal error: Uncaught OAuthException: (#1500) The url you supplied is invalid thrown
in /home/a1395850/public_html/src/base_facebook.php on line 1254
我的范围内有以下内容:-'email,publish_stream,publish_actions,user_likes'
以下是我发布用户墙链接的代码:-
<?php
error_reporting(E_ALL); ini_set('display_errors', 'On');
require 'src/facebook.php';
include 'app_details.php';
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
$permissions = $facebook->api("/me/permissions");
if( array_key_exists('publish_stream', $permissions['data'][0]) ) {
// Permission is granted!
// Do the related task
$args = array(
'message' => 'Hello from app',
'link' => 'laafo.uni.me',
'caption' => 'Facebook API Tutorials!'
);
$post_id = $facebook->api("/me/feed", "post", $args);
} else {
// We don't have the permission
// Alert the user or ask for the permission!
header( "Location: " . $facebook->getLoginUrl(array("scope" => "publish_stream")) );
}
?>
请帮助我...在此先感谢。