我在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();
}
最近使用成功的代码创建了任何想法?提前谢谢!
我直到api:调用并转储这个$ data(befor call)
数组([名称] => AGENT-TIME_STAMP-标题[follow_up_action_url] => https://www.site.es/ [问题] =>数组([0] => FacebookAds \ Object \ LeadGenQuestion对象([数据] :protected] =>数组([key] => [label] => [options] => [type] => EMAIL)[_ type_checker:protected] => FacebookAds \ TypeChecker对象([type_data: FacebookAds \ TypeChecker:private] =>数组([key] => string [label] => string [options] => list [type] => string)[enum_data:FacebookAds \ TypeChecker:private] = > Array()[primitive_types:FacebookAds \ TypeChecker:private] =>数组([0] => unsigned int [1] => int [2] => bool [3] => string [4 ] =>对象[5] => datetime [6] =>浮动))))[context_card_id] => 1120914681377165 [legal_content_id] => 1166716330131814)
答案 0 :(得分:1)
感谢musashii!
LeadgenFormFields :: QUESTIONS =>数组(数组('类型' =>' EMAIL')),