php - 错误 "Unable to use the video in an ad creative. Video id XXX,XXX,XXX,XXX,XXX might not be id of a video, or you might not have permission to see it"

标签 php facebook-ads-api

我正在尝试使用 php-facebook-sdk 并借助 curl Facebook API 创建广告。

我已经使用 curl 上传了我的视频,它返回了一个 ID。现在,该视频 ID 将用于添加广告,但当我提交我的广告时,它会返回此错误:

object(stdClass)#568 (1) {
["error"]=>
object(stdClass)#563 (8) {
  ["message"]=>
  string(17) "Invalid parameter"
  ["type"]=>
  string(14) "OAuthException"
  ["code"]=>
  int(100)
  ["error_subcode"]=>
  int(2013004)
  ["is_transient"]=>
  bool(false)
  ["error_user_title"]=>
  string(28) "Invalid video in ad creative"
  ["error_user_msg"]=>
  string(144) "Unable to use the video in an ad creative. Video id 191,520,185,101,173 might not be id of a video, or you might not have permission to see it. "
  ["fbtrace_id"]=>
  string(11) "HSK5VFCiP6u"
  }
}

顺便返回的视频ID是191520185101173。

这是我的代码:

 $object_story_spec = array('page_id' => $page_id,'video_data' => array('video_id' => $video_id,'message' => $ad_message,'image_url' => $image_url,'title' => $ad_header,'call_to_action' => array('type' => 'LEARN_MORE', 'value' => array('link' => $ad_redirect))));
  $params = array(
    'url_tags' => 'utm_source=facebook',
    'image_url' => $image_url,
    'object_story_spec' => json_encode($object_story_spec),
    'access_token' => $pass_token,
  );

我还尝试将该 ID 直接放置到代码中(静态地),如下所示:

'video_id' => '191520185101173',

这样,它将运行并创建广告素材,但不知何故,当我尝试动态使用视频 ID 时,它会返回该错误。

有什么建议吗?

最佳答案

使用此代码解决您的问题:

video.remote_create()<br/><strong>video.waitUntilEncodingReady()</strong>

关于php - 错误 "Unable to use the video in an ad creative. Video id XXX,XXX,XXX,XXX,XXX might not be id of a video, or you might not have permission to see it",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53245599/

相关文章:

php - Codeigniter 多个 where 条件

php - 为什么 SQL/PHP 中的这个查询不起作用?

facebook - 无法通过非管理员的 access_token 获取 adaccounts 的事件

php - Facebook 广告 API 错误

php - 如何判断哪些 PHP 文件被实际使用,哪些没有被使用?

php - bindParam 和 NULL int 值

php - Laravel 通过传递 id 获取产品

python - 从 facebook ads api 获取所有事件的事件 - 如何设置过滤器

node.js - 在 FB 营销 api 中,有一个选项 export_format : 'csv' , 我如何下载 csv 文件?

android - Facebook 广告中的安装历史记录不足