Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Title, Artist, and Album Artwork in PHP

$
0
0

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;
?>

Viewing all articles
Browse latest Browse all 13200

Trending Articles