Just want to mention that I am really new to PHP... So I need to extract android .apk files grab the AndroidManifest.xml and then extract package, android:versionCode and android:versionName.
I know that there are tools to get this information, but I need to do this using PHP.
Here's what I got so far:
$zip = new ZipArchive();
$filename = "BluetoothChat.apk";
$zip_file = $zip->open($filename);
if ($zip_file === TRUE){
//print_r($zip->statName('AndroidManifest.xml'));
$xml = $zip->getFromName('AndroidManifest.xml');
echo $xml;
echo "\n";
$zip->close();
} else {
echo 'FAILED';
}
I can successfully unpack the apk file but cannot read the contents of the xml file itself. It's in android binary xml format.
Had anyone successfully done this? Or can point me into the right direction ? Thanks a lot!