1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
:

A so simple php script that get from sourceforge API the number of downloads of a project between two dates.

Syntax:

php5 ./sf_downloads.php project_name start_date end_date

NOTES:

* Project name must be the short name on sourceforge used, in example, in the URL of the project like https://sourceforge.net/projects/PROJECT_NAME

* Start and end date must be in YYYY-MM-DD format

Module data

<?php

/*
Get the downloads between two dates of a project from sourceforge.net
*/
if(isset($argv[1])) {
$project = $argv[1];
}
else {
$project = 'pandora';
}

if(isset($argv[2])) {
$start_date = $argv[2];
}
else {
$start_date = '2012-01-01';
}

if(isset($argv[3])) {
$end_date = $argv[3];
}
else {
$end_date = '2012-12-31';
}

$json_stats = file_get_contents("https://sourceforge.net/projects/$project/files/stats/json?start_date=$start_date&end_date=$end_date");
$stats = json_decode($json_stats, true);
echo $stats['total'];

?>
(Visited 51 times, 1 visits today)