facebook php ads sdk-AdCraeative无效参数

时间:2018-07-18 15:01:17

标签: php facebook xampp facebook-php-sdk ads

我正试图进入Facebook php ads sdk。

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\Fields\AdCreativeFields;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;

$creative = new AdCreative(null, $account->id);
$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::TITLE => 'Welcome to the Jungle',
  AdCreativeFields::BODY => 'We\'ve got fun \'n\' games',
  AdCreativeFields::IMAGE_HASH => $image->hash,
  AdCreativeFields::OBJECT_URL => 'http://www.example.com/',
  AdCreativeObjectStorySpecFields::PAGE_ID => 101xxxxxxxxxxxxx,
));

$creative->create();
echo 'Creative ID: '.$creative->id . "\n";

我仍然收到此错误:

  

致命错误:未捕获的FacebookAds \ Http \ Exception \ AuthorizationException:C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Http \ Exception \ RequestException.php:144中的参数无效堆栈跟踪:#0 C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Http \ Client.php(215):FacebookAds \ Http \ Exception \ RequestException :: create(Object( FacebookAds \ Http \ Response))#1 C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Http \ Request.php(282):FacebookAds \ Http \ Client-> sendRequest(对象(FacebookAds \ Http \ Request))#2 C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Api.php(162):FacebookAds \ Http \ Request-> execute( )#3 C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Api.php(204):FacebookAds \ Api-> executeRequest(Object(FacebookAds \ Http \ Request))# 4 C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Object \ AbstractCrudObject.php(241):FacebookAd s \ Api-> call('/ act_4225516715 ...','POST'in C:\ xampp \ htdocs \ FB_ADS_PHP \ vendor \ facebook \ php-business-sdk \ src \ FacebookAds \ Http \ Exception \ RequestException.php在第144行

在此行:

$creative->create();

请帮忙吗?

1 个答案:

答案 0 :(得分:0)

因此,facebook API总是在变化并且超级烦人。您应该拥有的工作,我的意思是我正在阅读文档,但是设法使它起作用的方法是对广告词的边缘进行POST。

XWPFTableRow r = ...;
For(...){
  r.getCell(0).addNewParagraph(0).newRun().setText(...);

  // at this step of programm I want height of each cell and each paragraph, 
  // is this possible? Because each iteration my table row height increment..
}

但是我只是注意到在您的原始帖子中,您从哪里获得$ image-> hash?那可能是你的问题。