Get Application information from an APK using PHP script

余生颓废 提交于 2019-12-21 14:03:37

问题


How can I get the versionCode, versionName, application icon and application label from an APK with PHP


回答1:


I'm not that familiar with php so I can't provide any code, but the idea is:

  • unzip the APK file (since it's "nomal" zip format)
  • open the AndroidManifest.xml and
  • parse the <manifest> tag for android:versionCode and android:versionName



回答2:


If I'm not wrong, APKs are simply zip files. And android packages will have some sort of XML file that will mention the version information.

In PHP, you can unzip as well as read XMLs.




回答3:


As you might know an APK is a simple zip formated archive with it's metadata in XML format.

Try and unzip some apks and see which files have the information you need.

This can all be easily done in PHP.




回答4:


Well,

It is correct that the apk is in fact a zip-file and that is easy to unzip. However the manifest xml is not in standard xml format. It is some kind of propitiatory Android format.

You can use apktool to unpack the xml, but it is in Java and not very fun if you don't have Java on the server.

There is also a Python Library available, AXMLParsePY

Then we have AXmlPrinter2, also written in Java

I am myself looking for a PHP library and have given up. Now looking for something lightweight I can convert from some other language.



来源:https://stackoverflow.com/questions/7552667/get-application-information-from-an-apk-using-php-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!