简体   繁体   中英

How to get Ad Campaigns Spend tracking on Facebook Ads Api PHP SDK?

How can I get the campaigns on my Ad Account id using Facebook PHP SDK v2.8

public function sync_expenses_get()
{
    //initialize credentials
    $appId = $this->config->item('app_id');
    $appSecret = $this->config->item('app_secret');
    $accessToken = $this->config->item('access_token');
    Api::init($appId, $appSecret, $accessToken);

    $account = new AdAccount('act_<AD_ACCOUNT_ID>');
    $cursor = $account->getCampaigns();

}

And I am just getting an error like this

( ! ) Fatal error: Uncaught exception 'FacebookAds\\Http\\Exception\\AuthorizationException' with message '(#2) Service temporarily unavailable' in /htdocs/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Exception/RequestException.php on line 140

I just want to get first all the campaigns under my ad account ID.

The error you are getting is not based on your code, but is a generic error that is returned when a web service isn't able to respond to your request for some unexpected reason.

You should re-try your request in this case and in most cases this resolves the problem.

In the case that this is persistent, you should file a bug: https://developers.facebook.com/bugs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM