php - Get Podcast details from iTunes url -
is possible homecoming title, description, , image link podcast on itunes if have url?
for example, next url itunes:
https://itunes.apple.com/us/podcast/civil-beat-pod-squad/id902069464?mt=2
can podcast details via api phone call or along lines? ideally utilize php homecoming details.
you can utilize itunes search api fetch podcast info have track title , image.
using url example, can strip out id "90206964" , utilize curl.
function getid($url) { $id_pos = strpos($url, "/id") + 3; $length = strpos($url, "?", $id_pos) - $id_pos; homecoming substr($url, $id_pos, $length); } function fetchfromitunes($id) { $ch = curl_init("https://itunes.apple.com/lookup?id=" . $id); $options = array( curlopt_returntransfer => true, curlopt_httpheader => array('content-type: application/json') , ); curl_setopt_array( $ch, $options ); $results = curl_exec($ch); $results = json_decode($results,true); echo "[podcast title]" . $results["results"][0]["collectionname"] . "\n[artwork]" . $results["results"][0]["artworkurl600"] . "\n"; curl_close($ch); } php api itunes podcast
No comments:
Post a Comment