2011-11-22 2 views
0

내 벽에 Curl과 PHP를 받고 싶습니다. 나는 모든 것을 꺼내, 나는 그것을 읽을 수있는 유일한 사람입니다. "privacy"매개 변수를 { "value": "EVERYONE"}으로 설정 한 다큐멘터리의 입장은 모두가 읽을 수 있도록 설정해야합니다. 그러나 이것은 작동하지 않습니다. 나는 아직도 유일한 사람이다. 어떻게 변경할 수 있습니까?"프라이버시 값"은 PHP 당 Wall에 게시하고 작동하지 않습니다.

$url = "https://graph.facebook.com/oauth/access_token"; 
$client_id = "xxxxxxxxxxx"; 
$client_secret = "xxxxxxxxxxxxxxxxxxxxxx"; 
$postString = "client_id=$client_id&client_secret=$client_secret&type=client_cred"; 
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_URL, $url); 
curl_setopt($curl, CURLOPT_FAILONERROR, 1); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt($curl, CURLOPT_POST, 1); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $postString); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
$token = curl_exec($curl); 
curl_close($curl); 

$message = rawurlencode("Ich liebe hannaee"); 
$url = "https://api.facebook.com/method/stream.publish"; 
$apost = array("message"=>$message,"uid"=>xxxxxxxxxxxxxxx,"access_token"=>$token,"privacy"=>json_encode(array("value"=>"EVERYONE"))); 
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_URL, $url); 
curl_setopt($curl, CURLOPT_FAILONERROR, 1); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt($curl, CURLOPT_POST, 1); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $apost); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
$response = curl_exec($curl); 
curl_close($curl); 

답변

0

http://developers.facebook.com/docs/reference/api/post/에 따르면, 당신은 publish_stream 권한이 필요합니다 (http://developers.facebook.com/docs/authentication/ 참조) 응용 프로그램 샌드 박스 모드가 아니어야합니다.

업데이트 : Facebook Graph API - authorization types?에 답변 유형 = client_cred 이유는 사용하지 않아야한다고 설명한다.

+0

허가가 있습니다. 그렇지 않으면 내 게시판에 아무 것도 표시되지 않습니다. 마찬가지로 샌드 박스에서 실행되지 않을 것입니다. Secret Key와 APIID를 사용하여 내 응용 프로그램과 내 목표를 AccountId로 사용합니다. –