我想通过php-dsk图API发布一个链接。当我在http://developers.facebook.com/tools/debug输入我的网址时,它显示了响应代码 - 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")) );
}
?>
请帮助我......提前致谢。
答案 0 :(得分:1)