[英]Retrieving leads from facebook marketing api
I am trying to retrieve leads of Facebook page forms from Facebook Marketing API using curl in PHP: 我正在尝试使用PHP中的curl从Facebook Marketing API检索Facebook页面表单的线索:
$ch = curl_init();
$user_link = https://graph.facebook.com/v2.7/'.$formDetails[0].'/leads?access_token='.$page->page_access_token;
curl_setopt($ch, CURLOPT_URL, $user_link);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$temp_output = curl_exec($ch);
I am getting leads from this curl hit, Now the problem is I want to retrieve based on timestamp as specified in https://developers.facebook.com/docs/marketing-api/guides/lead-ads/leads/v2.8 this is my code for retrieving leads based on timestamp 我正在从这次热潮中获得潜在客户,现在的问题是我想根据https://developers.facebook.com/docs/marketing-api/guides/lead-ads/leads/v2.8中指定的时间戳进行检索这是我的基于时间戳检索潜在客户的代码
$data = [array(
"field" => "time_created",
"operator" => "GREATER_THAN",
"value" => 1476275295
)];
$data = json_encode($data);
$ch = curl_init();
$user_link = "https://graph.facebook.com/2.7/<form_id>/leads?filtering=".$data."&access_token=my access token";
curl_setopt($ch, CURLOPT_URL, $user_link);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$temp_output = curl_exec($ch);
$output = json_decode($temp_output);
I am getting error as 我收到错误消息
{
"error": {
"message": "Unknown path components: /my form_id/leads",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "CP5hFV3v1zN"
}
}
When retrieving the leads using either /leads of leads, you get the created date time timestamp which looks like "created_time": "2017-03-08T23:15:14+0000" 使用潜在客户的/ leads检索潜在客户时,您将获得创建的日期时间时间戳,看起来像是“ created_time”:“ 2017-03-08T23:15:14 + 0000”
If you use the UNIX timestamp value for for the above in the filtering parameter the api will only return those leads which were generated post the specified time. 如果您在过滤参数中将UNIX时间戳值用于上述内容,则api将仅返回在指定时间后生成的线索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.