Skip to content

Instantly share code, notes, and snippets.

@carcam
Last active August 5, 2017 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carcam/369af25d104ce43959a842cb5dda21fd to your computer and use it in GitHub Desktop.
Save carcam/369af25d104ce43959a842cb5dda21fd to your computer and use it in GitHub Desktop.
Get itunes reviews for podcasts
<?php
//Set here the Apple ID of your podcast
$iTunesId = 1241730868;
$countries =["benl","befr","bg","cz","dk","de","ee","es","fr","gr","hr","ie","it","lv","li","lt","lu","mk","hu","mt","md","me","nl","no","at","pl","pt","ro","ru","sk","si","chde","chfr","fi","se","tr","uk","lae","lae","la","lae","lae","lae","la","br","lae","lae","cl","co","la","lae","la","la","la","lae","la","lae","la","lae","mx","lae","la","la","la","la","lae","lae","lae","lae","lae","lae","lae","la","la","la","lae","ca","lae","la",];
$countries = array_unique($countries);
foreach ($countries as $country)
{
$reviews = file_get_contents("https://itunes.apple.com/$country/rss/customerreviews/id=$iTunesId/sortby=mostrecent/json");
$reviewsObj = json_decode($reviews);
$podcastArray = $reviewsObj->feed->entry;
if(count($podcastArray)>1)
{
array_shift($podcastArray);
foreach($podcastArray as $review)
{
echo "<div>";
echo "<h2>" . $review->title->label . "(" . $review->author->name->label . ")" . "</h2>";
echo "<p>" . $review->content->label . "</p>";
echo "</div>";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment