gpt4 book ai didi

php - 使用 Facebook PHP SDK 获取 Facebook 广告内容

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:44:00 29 4
gpt4 key购买 nike

我正在尝试获取 Facebook 广告的内容。或者更准确地说:作为广告一部分的链接。我可以从内容中提取链接,但首先似乎无法获取内容。

初始化连接后,我得到当前的广告帐户:

$me = new AdUser('me');

/** @var AdAccount $account */
$account = $me->getAdAccounts()->current();

我尝试了事件、广告和创意,但它们都没有包含添加的实际 html 内容。

$campaigns = $account->getCampaigns([
CampaignFields::ID,
CampaignFields::NAME
]);

$ads = $account->getAds([
AdFields::ID,
AdFields::NAME
]);

$creatives = $account->getAdCreatives([
AdCreativeFields::NAME,
AdCreativeFields::BODY
]);

据我所知,事件和广告中没有匹配的字段。我查看了 $object->getData() 返回的所有字段。

最佳答案

您应该请求包含必填字段的正确字段集:

$creatives = $account->getAdCreatives([
AdCreativeFields::NAME,
AdCreativeFields::BODY,
AdCreativeFields::LINK_DEEP_LINK_URL,
AdCreativeFields::LINK_URL,
]);

当前完整的字段列表是:

class AdCreativeFields extends AbstractEnum {
const ACTOR_ID = 'actor_id';
const ACTOR_IMAGE_HASH = 'actor_image_hash';
const ACTOR_NAME = 'actor_name';
const ADLABELS = 'adlabels';
const APPLINK_TREATMENT = 'applink_treatment';
const BODY = 'body';
const CALL_TO_ACTION_TYPE = 'call_to_action_type';
const DYNAMIC_AD_VOICE = 'dynamic_ad_voice';
const FOLLOW_REDIRECT = 'follow_redirect';
const ID = 'id';
const IMAGE_HASH = 'image_hash';
const IMAGE_FILE = 'image_file';
const IMAGE_URL = 'image_url';
const IMAGE_CROPS = 'image_crops';
const INSTAGRAM_ACTOR_ID = 'instagram_actor_id';
const INSTAGRAM_PERMALINK_URL = 'instagram_permalink_url';
const LINK_DEEP_LINK_URL = 'link_deep_link_url';
const LINK_URL = 'link_url';
const NAME = 'name';
const OBJECT_ID = 'object_id';
const OBJECT_STORY_ID = 'object_story_id';
const OBJECT_STORY_SPEC = 'object_story_spec';
const OBJECT_STORE_URL = 'object_store_url';
const OBJECT_TYPE = 'object_type';
const OBJECT_URL = 'object_url';
const PLACE_PAGE_SET_ID = 'place_page_set_id';
const PREVIEW_URL = 'preview_url';
const PRODUCT_SET_ID = 'product_set_id';
const RUN_STATUS = 'run_status';
const TEMPLATE_URL = 'template_url';
const THUMBNAIL_URL = 'thumbnail_url';
const TITLE = 'title';
const URL_TAGS = 'url_tags';
const VIDEO_ID = 'video_id';
}

关于php - 使用 Facebook PHP SDK 获取 Facebook 广告内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34179265/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com