根据官方文档DCM/DFA Reporting and Trafficking API以这种方式获取 json 格式的报告文件列表:
$url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/" . $this->profile_id . "/reports/" . $this->report_id . "/files?key=" . $this->developer_key;
$opts = array(
'http' => array(
'method' => "GET",
'header' => "content-encoding: gzip,
content-length: 863,
content-type: application/json; charset=UTF-8"
)
);
$context = stream_context_create($opts);
$response = file_get_contents($url, false, $context);
var_dump($response);
但是,$response
返回错误。我在 API explorer 中玩过它,它在那里工作得很好。有什么想法吗?