简体   繁体   English

Marketing API Facebook SDK

[英]Marketing API Facebook SDK

So Sorry but I'm quite new to Facebook SDK and API's. 抱歉,但是我对Facebook SDK和API还是陌生的。 I tried to use the marketing API provided by Facebook itself. 我尝试使用Facebook本身提供的营销API。

In the quickstart, I followed all the steps provided by the site itself. 在快速入门中,我遵循了网站本身提供的所有步骤。

It will generate a sample code to use to my simple application. 它将生成示例代码以用于我的简单应用程序。

I came accross an error in which I have to change a line as shown below and thought it might help other in the future. 我遇到了一个错误,必须更改一条线,如下所示,并认为它将来可能会帮助其他人。

If you came accross an error which told you about the deprecated v2.11 check below 如果遇到错误,告诉您以下不推荐使用的v2.11检查

From this 由此

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

To This 对此

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

Now, moving on to my problem. 现在,继续解决我的问题。

The second part of the code is as shown below 代码的第二部分如下所示

$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);

I'm having problem with this part 我这部分有问题

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

The error im getting is this 我得到的错误是这个

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

Any help will be highly appreciated. 任何帮助将不胜感激。

Change this: 更改此:

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

For this: 为了这:

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