facebook api marketing create campaign issue

I would like to create a campaign using Facebook API. I tried to run all available example without success.

First of all I created an App in order to have a APP_ID and a APP_SECRET.

I did all the procedure to add my Ad_account following the tutorial.

I downloaded all the SDK to facilitate Facebook API use like:

1) facebook-php-ads-sdk and run adgroup_creation.php and curl_log.php with my data, without success.

2) facebook-php-sdk-v4 I suppose it is less specific than the previous one.

3) Multi-Product Ads with the Facebook Marketing POST -> developers.facebook.com/ads/blog/post/2015/03/26/creating-multi-product-ads/

4) the developers reference -> developers.facebook.com/docs/reference/php/4.0.0

I used “Composer” to get all dependency.

In all this case I had problem to create a campaign using more or less this code:

$campaign = new FacebookAdsObjectAdCampaign(null,"act_$ACCOUNT_ID");

$campaign->setData(array(
AdCampaignFields::NAME => 'My First Campaign',
AdCampaignFields::OBJECTIVE => AdObjectives::WEBSITE_CLICKS,
AdCampaignFields::STATUS => AdCampaign::STATUS_PAUSED ));

// PROBLEM is Here 
$campaign->create();

Any help? How can I get a more useful error?

(Sorry, I can’t post more than 2 links because my reputation is less then 10)


Source: php

Leave a Reply