簡體   English   中英

Marketing API Facebook SDK

[英]Marketing API Facebook SDK

抱歉,但是我對Facebook SDK和API還是陌生的。 我嘗試使用Facebook本身提供的營銷API。

在快速入門中,我遵循了網站本身提供的所有步驟。

它將生成示例代碼以用於我的簡單應用程序。

我遇到了一個錯誤,必須更改一條線,如下所示,並認為它將來可能會幫助其他人。

如果遇到錯誤,告訴您以下不推薦使用的v2.11檢查

由此

$fields = array(
);
$params = array(
   'name' => 'Test Catalog',
);
$product_catalog = (new Business($business_id))->createProductCatalog(
  $fields,
  $params
);

對此

$fields = array(
);
$params = array(
    'name' => 'Test Catalog',
);
$product_catalog = (new Business($business_id))->createOwnedProductCatalog(
   $fields,
   $params
);

現在,繼續解決我的問題。

代碼的第二部分如下所示

$fields = array(
);
$params = array(
   'name' => 'Test Feed',
    'schedule' => array('interval' => 'DAILY','url' => 'https://developers.facebook.com/resources/dpa_product_catalog_sample_feed.csv','hour' => '22'),
);
echo json_encode((new ProductCatalog($product_catalog_id))->createProductFeed(
   $fields,
   $params
 )->getResponse()->getContent(), JSON_PRETTY_PRINT);

我這部分有問題

)->getResponse()->getContent(), JSON_PRETTY_PRINT);

我得到的錯誤是這個

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined method FacebookAds\Object\ProductFeed::getResponse()

任何幫助將不勝感激。

更改此:

echo json_encode((new ProductCatalog($product_catalog_id))->createProductFeed(
   $fields,
   $params
 )->getResponse()->getContent(), JSON_PRETTY_PRINT);

為了這:

echo json_encode((new ProductCatalog($id))->createProductFeed(
  $fields,
  $params
)->exportAllData(), JSON_PRETTY_PRINT);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM