Solved

RSS Enclosures in PHP

Posted on 2006-10-26
3
1,786 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

756 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