我正在复制完全相同的简单示例,用于在facebook上创建潜在客户(https://developers.facebook.com/docs/marketing-api/guides/lead-ads/create)
我正在使用API SDK PHP并运行$ form.create();我正在记录这个错误..
致命错误:未捕获的FacebookAds \ Http \ Exception \ AuthorizationException:(#100)参数问题[0] [类型]在C:\ inetpub \ wwwroot \ leads \ vendor \ facebook \ php-ads-sdk \ src \ FacebookAds中是必需的\ HTTP \异常\ RequestException.php:
这是功能代码 .
function create_form($page_id,$form_name,$url_follow,$idlegal,$idcontext){
$form = new LeadgenForm(null, $page_id);
$form->setData(array(
LeadgenFormFields::NAME => $form_name,
LeadgenFormFields::FOLLOW_UP_ACTION_URL => $url_follow,
LeadgenFormFields::QUESTIONS => array(
(new LeadGenQuestion())->setData(array(
LeadgenQuestionFields::TYPE => 'EMAIL',
)),
),
'context_card_id' => $idcontext,
'legal_content_id' => $idlegal,
));
$form->create();
}
最近使用成功的代码创建了$ idcontext $ idlegal .
任何的想法?提前致谢!
我直到api:调用并转储这个$ data(befor call)
数组([name] => AGENT-TIME_STAMP-Title [follow_up_action_url] => https://www.site.es/ [questions] =>数组([0] => FacebookAds \ Object \ LeadGenQuestion对象([data:protected] =>数组([key] = > [label] => [options] => [type] => EMAIL)[_ type_checker:protected] => FacebookAds \ TypeChecker对象([type_data:FacebookAds \ TypeChecker:private] => Array([key] => string [ label] => string [options] => list [type] => string)[enum_data:FacebookAds \ TypeChecker:private] => Array()[primitive_types:FacebookAds \ TypeChecker:private] => Array([0] => unsigned int [1] => int [2] => bool [3] => string [4] => Object [5] => datetime [6] => float))))[context_card_id] => 1120914681377165 [legal_content_id ] => 1166716330131814)
2 回答
解决了musashii!
LeadgenFormFields :: QUESTIONS => array(array('type'=>'EMAIL')),
而不是
LeadgenQuestionFields::TYPE => 'EMAIL'
试试这个
'type' => 'EMAIL'