从facebook营销api检索线索

时间:2016-10-14 13:54:39

标签: php curl facebook-marketing-api

我正在尝试使用PHP中的curl从Facebook Marketing API检索Facebook页面表单的潜在客户:

 $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);

我从这个curl hit获得了引导,现在问题是我想根据https://developers.facebook.com/docs/marketing-api/guides/lead-ads/leads/v2.8中指定的时间戳检索 这是我根据时间戳检索潜在客户的代码

{
  "error": {
    "message": "Unknown path components: /my form_id/leads",
    "type": "OAuthException",
    "code": 2500,
    "fbtrace_id": "CP5hFV3v1zN"
  }
}

我收到错误

<!DOCTYPE html>
<html style="background: yellow; padding: 0; margin: 0; width: 1100px;">
<head> 
<!--
    <meta name="viewport" content="width=2200, initial-scale=1">        
-->
</head>
<body>

    <div class="container" style="width: 400px; background: red;">
        <div style="background: green; width: 300px; height: 200px;">

             Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes my text Here goes 
        </div>
    </div>

</body>
</html>

1 个答案:

答案 0 :(得分:1)

使用/ lead引线检索潜在客户时,您将获得创建的日期时间时间戳   “created_time”:“2017-03-08T23:15:14 + 0000”

如果在过滤参数中对上述内容使用UNIX时间戳值,则api将仅返回在指定时间后生成的那些潜在客户。