{"id":301,"date":"2017-12-13T09:55:33","date_gmt":"2017-12-13T09:55:33","guid":{"rendered":"https:\/\/pandorafms.com\/library\/?p=301"},"modified":"2017-12-13T10:47:47","modified_gmt":"2017-12-13T10:47:47","slug":"project-downloads-in-sourceforge","status":"publish","type":"post","link":"https:\/\/pandorafms.com\/library\/project-downloads-in-sourceforge\/","title":{"rendered":"Project downloads in Sourceforge"},"content":{"rendered":"<p>A so simple php script that get from sourceforge API the number of downloads of a project between two dates.<\/p>\n<p>Syntax:<\/p>\n<pre>php5 .\/sf_downloads.php project_name start_date end_date<\/pre>\n<p>NOTES:<\/p>\n<p>* Project name must be the short name on sourceforge used, in example, in the URL of the project like <em>https:\/\/sourceforge.net\/projects\/PROJECT_NAME<\/em><\/p>\n<p>* Start and end date must be in YYYY-MM-DD format<\/p>\n<h2>Module data<\/h2>\n<pre>\r\n&lt;?php\r\n\r\n\/*\r\nGet the downloads between two dates of a project from sourceforge.net\r\n*\/\r\nif(isset($argv[1])) {\r\n$project = $argv[1];\r\n}\r\nelse {\r\n$project = 'pandora';\r\n}\r\n\r\nif(isset($argv[2])) {\r\n$start_date = $argv[2];\r\n}\r\nelse {\r\n$start_date = '2012-01-01';\r\n}\r\n\r\nif(isset($argv[3])) {\r\n$end_date = $argv[3];\r\n}\r\nelse {\r\n$end_date = '2012-12-31';\r\n}\r\n\r\n$json_stats = file_get_contents(\"https:\/\/sourceforge.net\/projects\/$project\/files\/stats\/json?start_date=$start_date&amp;end_date=$end_date\");\r\n$stats = json_decode($json_stats, true);\r\necho $stats['total'];\r\n\r\n?&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[11],"tags":[58,57],"_links":{"self":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts\/301"}],"collection":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/comments?post=301"}],"version-history":[{"count":0,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/posts\/301\/revisions"}],"wp:attachment":[{"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/categories?post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pandorafms.com\/library\/wp-json\/wp\/v2\/tags?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}