Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.