I need to get an info about the app/song/video by item id from iTunes Store.
I\'ve found this
But it doesn\'t work with apps.
Is there any public API
I wrote this script for myself. It's not optimized or future-proof, but it's working for me in the meantime...
Four stars: " . $ratings[1];
echo "
Three stars: " . $ratings[2];
echo "
Two stars: " . $ratings[3];
echo "
One star: " . $ratings[4];
echo "
Total ratings: " . getTotalRatings($ratings);
echo "
Average rating: " . getAverageRating($ratings);
}
function getTotalRatings($ratings)
{
$temp = 1;
for($i=0; $i < count($ratings); ++$i)
$temp+=$ratings[$i];
return $temp;
}
function getAverageRating($ratings)
{
$totalRatings = getTotalRatings($ratings);
return round(5*($ratings[0]/$totalRatings)
+ 4*($ratings[1]/$totalRatings)
+ 3*($ratings[2]/$totalRatings)
+ 2*($ratings[3]/$totalRatings)
+ 1*($ratings[4]/$totalRatings),2);
}
function getXML($ratings)
{
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
echo '';
echo '';
echo ''.$ratings[0].' ';
echo ''.$ratings[1].' ';
echo ''.$ratings[2].' ';
echo ''.$ratings[3].' ';
echo ''.$ratings[4].' ';
echo ''.getTotalRatings($ratings).' ';
echo ''.getAverageRating($ratings).' ';
echo ' ';
}
?>