Last active
August 5, 2017 08:35
-
-
Save carcam/369af25d104ce43959a842cb5dda21fd to your computer and use it in GitHub Desktop.
Get itunes reviews for podcasts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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