我想將日期參數傳遞到PHP SDK批量請求方法。將日期參數傳遞給Facebook批量請求
是否有可能在日期PARAMS如通過:
$params = array(
'time_range' => array(
'since' => (new \DateTime("-1 week"))->format('Y-m-d'),
'until' => (new \DateTime())->format('Y-m-d'),
),
);
我的批量要求基本上是:
foreach($campaign_ids as $campaign_id) {
$batch[] = $fb->request('GET/', env("FB_APP_VERSION") . '/' . $campaign_id . '/insights?fields=impressions,unique_clicks,reach');
}
try {
$responses = $fb->sendBatchRequest($batch);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}