2011-07-24 5 views
0

を公開私持っている問題...私はFacebookのAPIでthis site ...イム良くない従わなかった...申し訳ありませんイムは本当に.. APIでFacebookのストリーム

私のコード初心者:

<?php 


define('FB_APIKEY', '***************************'); 
define('FB_SECRET', '***************************'); 
define('FB_SESSION', '***************************'); 

require_once 'facebook-platform/php/facebook.php'; 

echo "post on wall"; 
echo "<br/>"; 

try { 
$facebook = new Facebook(FB_APIKEY, FB_SECRET); 
$facebook->api_client->session_key = FB_SESSION; 
$facebook->api_client->expires = 0; 
$message = 'testasdfsadf'; 

$attachment = array(
'name' => $_POST["name"], 
'href' => $_POST["href"], 
'description' => $_POST["description"], 
'media' => array(array('type' => 'image', 
'src' => $_POST["src"], 
'href' => $_POST["href"]))); 

$action_links = array(array('text' => 'TITLE', 'href' => 'http://www.mysite.com')); 

$attachment = json_encode($attachment); 
$action_links = json_encode($action_links); 

$target_id = "2410160********"; 
$session_key = FB_SESSION; 


    if($facebook->api_client->stream_publish($message, $attachment, $action_links, null, $target_id)) { 
    echo "Added on FB Wall"; 
    } 
    } catch(Exception $e) { 
    echo $e . "<br />"; 
    } 
?> 

Iを得たエラー:ここ

ソリューション:

post on wall 
exception 'FacebookRestClientException' with message 'The user hasn't authorized the application to perform this action' in /Users/*****/Sites/FacebookTEST/facebook-platform/php/facebookapi_php5_restlib.php:3025 Stack trace: #0 /Users/******/Sites/FacebookTEST/facebook-platform/php/facebookapi_php5_restlib.php(916): FacebookRestClient->call_method('facebook.stream...', Array) #1 /Users/******/Sites/FacebookTEST/index.php(46): FacebookRestClient->stream_publish('testasdfsadf', '{"name":null,"h...', '[{"text":"TITLE...', NULL, '2410160********') #2 {main} 
+0

「あなたの壁に公開するための許可を与える」という手順に従っていますか? – Mike

+0

私は答えを見つけました...許可するリンクを使用して.. – user453089

+0

この記事は本当に**本当に**古いです! [最新の](https://github.com/facebook/php-sdk)SDKをチェックしてから、私の[article](http://www.masteringapi.com/tutorials/how-to-post- a-message-on-the-user-wall-using-facebook-graph-api/33 /)を[example.php](http://github.com/facebook/php-sdk/blob/master/examples /example.php)。 – ifaour

答えて

0

私は答えを見つけた http://www.facebook.com/connect/prompt_permissions.php?api_key=YOUR_API_KEY & V = 1.0 &次=のhttp:?//www.facebook.com/connect/login_success.html xxRESULTTOKENxx &表示=ページ& ext_perm = publish_stream、offline_access & enable_profile_selector = 1 & profile_selector_ids = ID_OF_YOUR_PAGE

APIキーとページIDをBOLDテキストに挿入してください。

関連する問題