我正在尝试使用Facebook Ads API制作广告。所以,我已经创建了广告集,广告素材和广告系列,但是,当我使用以下代码创建广告组时,我收到了无效参数异常。如果我在以下代码中有任何错误,请建议我。
$campaignId = "xxx";
$appId= "xx";
$ci = "xxx";
$accountId = "xxx";
$appSecret= "xxx";
$accessToken= "xxx";
Api::init($appId, $appSecret, $accessToken);
$api = Api::instance();
$adgroup = new AdGroup(null, $accountId);
$adgroup->setData(array(
AdGroupFields::CREATIVE =>
array('creative_id' => $ci),
AdGroupFields::NAME => 'My First AdGroup',
AdGroupFields::CAMPAIGN_ID => $campaignId,
AdGroupFields::ADGROUP_STATUS => AdGroup::STATUS_PAUSED,
));
$adgroup->create();
我收到的错误:
致命错误:未捕获的异常'FacebookAds \ Http \ Exception \ AuthorizationException',并在/ var / www / fb / vendor / facebook / php-ads-sdk / src / FacebookAds / Http / Exception / RequestException中显示消息'无效参数' .php:137堆栈跟踪:#0 /var/www/fb/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Client.php(216):FacebookAds \ Http \ Exception \ RequestException :: create(数组,500)#1 /var/www/fb/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Request.php(282):FacebookAds \ Http \ Client-> sendRequest(Object(FacebookAds \ Http \ Request))#2 /var/www/fb/vendor/facebook/php-ads-sdk/src/FacebookAds/Api.php(152):FacebookAds \ Http \ Request-> execute()#3 / var /www/fb/vendor/facebook/php-ads-sdk/src/FacebookAds/Api.php(194):FacebookAds \ Api-> executeRequest(Object(FacebookAds \ Http \ Request))#4 / var / www / fb / vendor / facebook / php-ads-sdk / src / FacebookAds / Object / AbstractCrudObject.php(248):FacebookAds \ Api-> call('/ act_1602736963 ...','POST',Array)#5 / var / www / fb / ads.php(46):FacebookAds \ Object \ AbstractC第137行/var/www/fb/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Exception/RequestException.php中的rudObject-> create()#6 {main}
答案 0 :(得分:1)
问题是我没有与我的帐户关联的导致错误的付款方式。