Fijiannn Posted January 4, 2014 Share Posted January 4, 2014 Hi I have an .mp3 file on my host that has a title, artist, and album artwork. How can I capture this in PHP so then I can go to my iPhone app and use what the PHP file captured? <?php function fooFucker($url) { $a = join('/', array_map('urlencode', explode('/', $url))); return str_replace('+', '%20', $a); } $SongsFolder = "songs"; header("Content-Type: audio/x-mpegurl"); $body = ''; $Songs = glob($SongsFolder."/*.mp3"); shuffle($Songs); $first = 0; foreach($Songs as $Song) { $SongPath = pathinfo($Song); if ($first != 0) { $body .= "\n"; } $first = 1; $body .= "http://".$_SERVER['HTTP_HOST'].fooFucker(dirname($_SERVER['PHP_SELF']))."/".fooFucker($SongsFolder)."/".fooFucker($SongPath['basename']); } header('Content-Length: ' . strlen($body)); echo $body; ?> Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/ Share on other sites More sharing options...
trq Posted January 4, 2014 Share Posted January 4, 2014 Your question is far too vague. Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/#findComment-1463809 Share on other sites More sharing options...
Barand Posted January 4, 2014 Share Posted January 4, 2014 this should help http://en.wikipedia.org/wiki/ID3 Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/#findComment-1463844 Share on other sites More sharing options...
Fijiannn Posted January 4, 2014 Author Share Posted January 4, 2014 this should help http://en.wikipedia.org/wiki/ID3 How could I install what it needs on a Mac? Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/#findComment-1463866 Share on other sites More sharing options...
Psycho Posted January 5, 2014 Share Posted January 5, 2014 If you want to use PHP to extract the ID3 info for an MP3, then I would highly suggest using getID3(). Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/#findComment-1463888 Share on other sites More sharing options...
Fijiannn Posted January 5, 2014 Author Share Posted January 5, 2014 If you want to use PHP to extract the ID3 info for an MP3, then I would highly suggest using getID3(). Will this install to GoDaddy shared hosting? Sorry I'm more of an iPhone app developer and trying learn this PHP stuff. I feel like my PHP code I'm using above will not be able to get the title, artist, and album artwork because of the way it's set up. You have any examples on how I can go about doing this? Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/#findComment-1463892 Share on other sites More sharing options...
ignace Posted January 5, 2014 Share Posted January 5, 2014 (edited) getID3 is a PHP function. You can install it locally through composer: https://packagist.org/packages/james-heinrich/getid3 Or you can simply download it as a .zip and extract it in your project root: https://github.com/JamesHeinrich/getID3/archive/master.zip Edited January 5, 2014 by ignace Quote Link to comment https://forums.phpfreaks.com/topic/285081-title-artist-and-album-artwork-in-php/#findComment-1463904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.