Use this with pclzip.lib.php Library..
<?php
require_once 'pclzip.lib.php';
$path = 'path/to/apk';
$default = 'path/to/default_icon.png';
$destination = 'path/to/destination.png';
$zip = new PclZip($path);
$data = $zip->extract(PCLZIP_OPT_BY_PREG, "/res\/drawable(|-ldpi|-mdpi|-hdpi|-xhdpi)\/(ic_launcher|icon|logo|icn|ic|i).(png|jpg|jpeg|gif)/isU", PCLZIP_OPT_PATH, './tmp', PCLZIP_OPT_REMOVE_ALL_PATH);
$icn = end($data);
$icn = $icn['filename'];
//now you have path to the icon in ./tmp folder
if(!empty($icn)){
copy($icn, $destination);
} else{
copy($default, $destination);
}
foreach($data as $dt){
@unlink($dt['filename']);
}
?>
I hope this will work for you..
EDIT:
At the time of my first answer, there wasn't a reliable method/library available. So, I created a temporary method. Which was working for me.
Now, we have a better library, you should use that.
Library: php-apk-parser by Tufan Barış YILDIRIM
Example: ApkResource.php