Solved

RSS Enclosures in PHP

Posted on 2006-10-26
3
1,762 Views
Last Modified: 2010-05-18
Trying to obtain the <enclosure> details for a podcasting page...  I've got the content displaying properly but I need to access the content inside the enclosure.

Outputting the item gives:

[enclosure] => Array
        (
            [url] => http://website/directory/name.mp3
            [length] => 4,374,069
            [type] => audio/mp3
        )

So I've got a "download this podcast" link but I can't get the [url] element from the enclosure... what is the syntax for doing this?  Because it sure as butters isn't $item[url]

Offering 500 points because it's important!
0
Comment
Question by:seopher
3 Comments
 
LVL 14

Expert Comment

by:Aamir Saeed
ID: 17810667
Please try this function,

function downloadfile($file,$ctype){
      header("Pragma: public");
      header("Expires: 0");
      header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
      header("Cache-Control: private",false);
      header("Content-Type: $ctype;");                  
      header('Content-Disposition: attachment; filename='.basename($file).';');
      header("Content-Length: ".filesize($file).";");
      readfile($file);
}
0
 
LVL 16

Accepted Solution

by:
OliWarner earned 500 total points
ID: 17812147
Just have an array of arrays. and access them like so: $arr['enclosure']['url|length|type']
0
 
LVL 3

Author Comment

by:seopher
ID: 17812184
Ugh, thanks I was being rather dumb, that's done the trick perfectly.

Nice work.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question