I would like to get content from my app page on google play to my website. Right now I get all content that is included in the .content class. But I would like to get ONLY numbers of installs. This div looks like this:
<div class="content" itemprop="numDownloads"> </div>
Anybody knows how to get the itemprop="numDownloads" from the .content class?
This is my code right now:
blade.php
<?php echo file_get_contents($_GET['url']); ?>
Script
<script>
$(function(){
var contentURI= 'https://play.google.com/store/apps/someapp .content';
$('#response').load('grab.php?url='+ contentURI);
});
</script>
You can use regular expression for this in PHP or in javascript also. Now I've implemented the PHP version, but with the pattern it could really easy to implement in javascript:
$siteContent = ''
. '<div class="content" itemprop="7"> </div>'
. '<div class="content" itemprop="5768"> </div>'
. '<div class="content" itemprop="69"> </div>';
$matches =array();
preg_match_all('/itemprop\s*=\s*[\'"]([^\'"]+)[\'"]/im', $siteContent, $matches);
var_dump($matches[1]);
The output is:
array
0 => string '7' (length=1)
1 => string '5768' (length=4)
2 => string '69' (length=2)