How to extract links to mp3s from an entry to make a playlist?
-
Problem
I run a music-blog and my authors copy links to the creative commons music mp3s directly in the post. Now, I want to extract these links to generate a special m3u-playlist. Therefore I made a new page and a new page template. Unfortunately I am no php-expert and after 4 hours I am quite frutstrated. I have a php-script which extracts the links, but now, I don’t know how to show them.Script
<?php /* Template Name: Netaudio Player Page */ ?> <?php query_posts('cat=106&showposts=1'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $content = get_the_content(''); function pc_link_extractor($s) { $a = array(); if (preg_match_all('/<a\s+.*?href=[\"\']?([^\"\' >]*)[\"\']?[^>]*>(.*?)<\/a>/i', $s,$matches,PREG_SET_ORDER)) { foreach($matches as $match) { array_push($a,array($match[1],$match[2])); } } return $a; } $a = pc_link_extractor($content); print_r($a); endwhile; endif; ?>
this gives me a wonderful list, with quite good results. but what now?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to extract links to mp3s from an entry to make a playlist?’ is closed to new replies.