Skip to content

Instantly share code, notes, and snippets.

@Techmind
Created October 26, 2012 12:14
Show Gist options
  • Save Techmind/3958454 to your computer and use it in GitHub Desktop.
Save Techmind/3958454 to your computer and use it in GitHub Desktop.
demo google play parser
<?php
$content = file_get_contents('https://play.google.com/store');
var_dump(strlen($content));
preg_match_all("~<a href=\"(/store/apps/category/[A-Z_]*)~", $content, $matches);
$cats = array_unique($matches[1]);
var_dump($cats);
$link2 = 'https://play.google.com/' . $cats[1];
$content2 = file_get_contents($link2) . "/collection/topselling_paid?start=0";
preg_match_all("~<a href=\"(/store/apps/details[^\"]*)~", $content2, $matches2);
$detailed = array();
$d_was = null;
$detailes = $matches2[1];
foreach ($detailes as $det_url) {
$link3 = 'https://play.google.com/' . $det_url . "&hl=en";
$detailed = file_get_contents($link3);
preg_match('~<div class="doc-banner-icon"><img ?(?:itemprop="image" ?)?src="([^"]*)"/>~', $detailed, $matches_det_img);
preg_match('~<td class="doc-banner-title-container"><h1 ?(?:itemprop="name" ?)?class="doc-banner-title">([^<]*)<~', $detailed, $matches_det_n);
echo "$link3; {$matches_det_img[1]}, {$matches_det_n[1]}\n";
}
@Madcapdev
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment