0
내가 페이스 북에 테스트 사용자의 이벤트에 사진을 시도하고 게시 할 PHP SDK를 사용하고
:Facebook 이벤트에 사진을 게시하려면 어떻게해야합니까?
$c = 0;
$facebook->setFileUploadSupport(true);
while ($c < count($_FILES['file']['name'])) {
aFile = $_FILES['file'];
//..other code for ui and validity checks..//
$real = realpath($aFile["tmp_name"][$c]);
$attachment = array('message' => 'Test upload');
$attachment['image'] = '@'.$real; //also tried other keys. Please see below...
try {
$result = $facebook->api('/'.$event_id.'/photos?access_token='.$access_token, 'post', $attachment);
}
catch (FacebookApiException $e) {
echo('Could not post image to Facebook:'.var_export($e));
}
$c++;
}
를 불행하게도, 내가 얻을 모든 오류입니다 : 내가하려고했는데
'message' => 'An unexpected error has occurred. Please retry your request later.', 'type' => 'OAuthException', 'code' => 2
이틀 동안이게 유일한 업로드 코드입니다. 그래서 페이스 북에 (내 경우에는) 500x500의 jpg 파일을 너무 자주 보내려고 시도하는 것이 거의 없습니다.
../photos?access_token=…
을 ../feed?access_token=..
으로 변경하면 텍스트는 게시되지만 이미지는 게시되지 않습니다. 로컬 파일에 대한 성공하지
$attachment[basename($real)] = '@'.$real;
및
$attachment['source'] = '@'.$real;
및
$attachment['picture'] = '@'.$real;
모든 :
은 또한 사용하여 이미지를 처리 시도했습니다. 그러나$attachment
에 마지막 열쇠 선택권은 (무작위) 웹 사이트에 그림에 URL를 가진 포스트를 허용 할 것이다.
누군가 내가 올바른 열린 그래프 가장자리에 '게시'하고 있는지 또는 이미지의 데이터를 처리하기 위해 코드에 실수가 있는지를 알 수 있습니까?