Skip to content
Izzy edited this page Dec 10, 2020 · 4 revisions

Search for Apps

There are several methods helping you with your search for apps. First step is always the same – you need to make the class available:

require "google-play.php";
$google = new GooglePlay();

Listing available categories

$cats = $google->parseCategories();

This will return an array of all categories currently available at Google Play. The array is not pre-defined, but freshly retrieved on-call. You can use each of those categories to browse its apps, see below.

Listing apps in a given category

$category = 'TRAVEL_AND_LOCAL';
$apps = $google->parseCategory($category);

Returns an array of package names from the specified category. It's usually something around 25 entries – basically what Google Play shows on the corresponding category page.

Listing Charts and Latest Additions

$charts = $google->parseTopApps();
$news   = $google->parseNewApps();

Charts usually have some 50+ apps, news around 25. In both cases, a list of package names is returned.

Listing what Google considers "similar apps" and "other apps from this developer"

$packageName = "com.bezapps.flowdiademo";
$similar = $google->parseSimilar($packageName);
$other   = $google->parseOthers($packageName);

Both returns an array of package names; usually around 5 entries or less. On error, they return ["success"=>0, "message"=>"(what went wrong)"].

Searching for apps by keywords

$query = 'sms backup';
$apps = $google->parseSearch($query);

Returns an array of up to 50 package names, matching your search terms.

How to action as a crawler and find more applications?

$alphas = range('A', 'Z');
foreach($alphas as $alpha) {
    $apps=$google->parseSearch($alpha);
    insertApps($apps);
}

Or:

$alphas = range('A', 'Z');
foreach($alphas as $alpha) {
    $apps=$google->parseSearch($alpha);
    insertApps($apps);
    foreach($alphas as $alpha2) {
        $apps=$google->parseSearch($alpha.$alpha2);
        insertApps($apps);
    }
}

It's more:

$alphas = range('A', 'Z');
foreach($alphas as $alpha) {
  $apps=$google->parseSearch($alpha);
  insertApps($apps);
  foreach($alphas as $alpha2) {
    $apps=$google->parseSearch($alpha.$alpha2);
    insertApps($apps);
    foreach($alphas as $alpha3) {
      $apps=$google->parseSearch($alpha.$alpha2.$alpha3);
      insertApps($apps);
    }
  }
}

Evaluating results

Structure of results for search functions looks like this:

Array
(
    [success] => 1
    [message] => 
    [data] => Array
        (
            [0] => de.rki.coronawarnapp
            [1] => us.zoom.videomeetings
            [2] => com.lidl.eci.lidlplus
...

If an error occured, the data array will be empty, success will be set to 0, and message will give you details on what possibly went wrong. If success is set to 1 and data is still empty, there are probably no results – and message will tell you exactly that. In al other cases, message will be there but empty.