duan205571 2016-10-14 13:54
浏览 72

从facebook营销api检索线索

I am trying to retrieve leads of Facebook page forms from Facebook Marketing API using curl in PHP:

$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

 $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"
  }
}
  • 写回答

1条回答 默认 最新

  • douwen0612 2017-05-16 19:01
    关注

    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"

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 求指导ADS低噪放设计
  • ¥15 CARSIM前车变道设置
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存