- get_headers: documentation ( source)
- array_change_key_case: documentation ( source)
- json_encode: documentation ( source)
- file_put_contents: documentation ( source)
<?php
$conf['dl_url'] = 'http://droidphp-repository.herokuapp.com/';
$conf['data'] = '/data/data/org.opendroidphp/';
$conf['file_system'] = '/sdcard/droidphp/';
function getFilesize($url){
$head = array_change_key_case(get_headers($url, TRUE));
return $head['content-length'];
}
$value[] = [
'repo_name' => 'Components Security Fix',
'repo_url' => 'https://dl.dropboxusercontent.com/s/ldl3y1tlqodkvfs/data_heartblead_fix.zip?dl=0',
'repo_install_location' => $conf['data'],
'repo_file_size' => getFilesize('https://dl.dropboxusercontent.com/s/ldl3y1tlqodkvfs/data_heartblead_fix.zip?dl=0'),
];
file_put_contents('packages.json', json_encode($value, JSON_PRETTY_PRINT));