I have implemented the functionality to activate an ad bypassing the ad ID. The script is running successfully but it does not return valid data or returning the curl data every time. Can anyone please let me know how can I access the valid return data from Facebook.
Every time this is returning the CURL data. I don't want the curl data. Can anyone let me know how this can be done?
I am using the Facebook Business API version 3.0
This is the code for ads Activation:
function activate_ad_requesttt($ad_id) {
$accessToken = getAccessToken();
$api = Api::init(app_id, app_secret, $accessToken);
$api->setLogger(new CurlLogger());
$caught = false;
try {
$ad = new Ad($ad_id);
$ad->update(array(
Ad::STATUS_PARAM_NAME => Ad::STATUS_ACTIVE,
));
$caught = true;
} catch(Facebookads\Http\Exception\AuthorizationException $e) {
$errorMsg = $e->getErrorUserMessage();
echo $errorMsg;
}
print_r($ad);
}