2013-03-27 2 views
0

FB 어플리케이션에 약간의 문제가 있습니다. 이 코드PHP API를 통해 fanpage에 비디오 업로드

{"error":{"message":"(#353) Missing video file","type":"OAuthException","code":353}}

:

  $post_url  = "https://graph-video.facebook.com/xxx/videos?" 
        . "title=" . $video_title . "&description=" . $video_desc 
        . "&access_token=" . $access_token; 
      $ch = curl_init(); 
      $data = array(
       'source' => 'http://x/upload/' . $name . '.' . $type, 
       'file' => './upload/' . $name . '.' . $type, 
       'type' => 'avi', 
      ); 
      curl_setopt($ch, CURLOPT_URL, $post_url); 
      curl_setopt($ch, CURLOPT_POST, 1); 
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
      $response = curl_exec($ch); 
      if (!$response) 
      { 
       print_r(Debug::vars(array(curl_error($ch), curl_errno($ch)))); 
      } 
      curl_close($ch); 

파일이 존재, access_token은 유효하고 응용 프로그램으로 기록됩니다 난 단지 '파일을'설정 해봤 $data, 나는 항상 오류가 있는지에 대해 그것은이다 또는 '출처'이지만 효과는 동일했습니다.

답변

0

Facebook PHP SDK를 사용하는 것이 가장 좋지만 파일 매개 변수를 제거하고 소스 경로에 "@"를 추가하는 것만 큼 간단합니다.) 도움을 들으, 난 너무 바보 야

$this->facebook->setFileUploadSupport(true); 

$upload = $this->facebook->api('/me/videos', 'POST', array(
    'source' => '@'.$file, 
    'title' => $title, 
    'description' => $description 
)); 
+0

다음은 SDK와 함께 작동 예 (가 적절한 FB 권한을 요구 한 가정)입니다 –