Solved

RSS Enclosures in PHP

Posted on 2006-10-26
3
1,817 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

623 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