如何从Google Play获取应用的统计信息

时间:2013-07-22 11:05:47

标签: google-play

我想从Google Play获取任何特定应用的统计信息。验证后,我将提供一个URL,该应用程序的相应统计信息将开始下载。有一个包含CSV文件的ZIP文件夹,可以下载。

我所做的是:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$data = array(
    'accountType' => 'GOOGLE',
    'Email'       => my mail address@gmail.com,
    'Passwd'      => my password for this account,
    'source'      => the name of that particular app,
    'service'     => 'writely'
);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$hasil = curl_exec($ch);

这是用于身份验证。在此之后,我想下载统计数据:

$ch = curl_init("https://play.google.com/apps/publish/statistics/download?package=[my apps name]&sd=[starting date]&ed=[ending date]&dim=[dimensional data]&met=[metrics data]&dev_acc=[developer account ID]");

$header[] = 'Authorization: GoogleLogin auth=' . $hasil;

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);

curl_exec($ch);  
curl_close($ch);

启动脚本后,下载应自动开始。

0 个答案:

没有答案