Fetching Android Repo With PHP

Now we will learn how to fetch values from android repository with PHP, and display it on your page. (See andiim3.com for example).

Usually, android user will use aptoide, APKtor, etc. to browse outside repo beside Google’s Android Market. But, there a lot of user prefer to download the apps from PC browser instead of their mobile.

We need to know that every android repo provide us a XML file to read. Named info.xml, it contains all the information needed by the client. So, we will fetch the info.xml.

I will explain the steps inline with the code. Remember, this is the basic script I use in alpha version of my website (andiim3.com). andiim3.com now use more advanced way to fetch the repos, but the basic method still included.

That’s it.. You may use this script in your own website. But I warn you, this method can waste your web hosting bandwidth if you don’t have an unlimited hosting plan.

As usually, I will give you the algorithm of my advanced script used in andiim3.com

  1. To save the bandwidth, we fetch the info.xml once a day, we use cron in cpanel
  2. In fetching process: first, we truncate the database before inserting new data to prevent duplicate rows. Then we insert all the new apk data back to the database.
  3. We don’t output the apk data in the cron job, it is unnecessary. We use another script to display the database to the audience. I think it’s quite easy to fetch the rows from database and display it on your pages. Smile Code it yourself!

The advantages of using database is to save your bandwidth, saves times (no need to fetch all the repos first for one only request), we can do easy APK searching, we can short it, we can track the statistic, etc.

Andi Setiawan

Loving husband - Caring Father - Slap bet Commissionaire (I wish) find my complete profile on: http://andisetiawan.com/about-me http://facebook.com/andiim3 - http://gplus.to/andiim3 - http://andiim3.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.