Hi WP users and Developers,
A little bit New to this, so your help would be appreciated, apologies if dumb question.
I want a link on a page that will essentially dynamically create a .pls file on the fly with unique content every time.
I am experimenting with ShortCodes, but have hit a brick wall at the end of my PHP and WP knowledge.
Another way might be using Javascript?
The issue is that the URL will change everytime. Design is to click the link, and the .pls file to open in say iTunes/ Xiia on a mobile phone, and play the file via "streaming"
- file is in Amazons3
- using s2Member function to dynamically create URL to get stream file
//Usage [Pls3 Filename="test" Title="test" URL="test.url"]
function plsS3_shortcode( $atts, $content = null, $code="" ) {
return CreatePLS($atts);
//echo "<script language=\"JavaScript\">alert(\"This is the message.".$atts['fn']."\");</script>";
} //end Shortcode Function
add_shortcode( 'PlsS3', 'plsS3_shortcode' );
function CreatePLS ($atts) {
$filename = $atts['fn'];
$Title = $atts['track'];
$ProtectedURL = $atts['url'];
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$filename.".pls\"");
$PLS = "[playlist]\n".
"File1=".$ProtectedURL."\n".
"Title1=".$Title." : 192k\n".
"Length1=-1\n".
"NumberOfEntries=1\n".
"Version=2";
} // End CreatePLS