Can't get my PHP-generated RSS to serve properly

Hey all -

Glad some of you found that sample data helpful. :-)

I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is =
submitted as *.xml and I use .htaccess to redirect it to my PHP =
document. The start of the document sets the right header and outputs =
the <? & ?> to prevent PHP from trying to process the leading XML line =
as code (this is cleaned up a bit for readability):

<?php
header("content-type: application/rss+xml");
echo '<?';
?>
xml version=3D"1.0" encoding=3D"UTF-8"
<?php
echo '?>';
?>
<rss xmlns:itunes=3D"http://www.itunes.com/dtds/podcast-1.0.dtd" =
xmlns:atom=3D"http://www.w3.org/2005/Atom" version=3D"2.0">

This has always worked fine on one podcast, but on a new one it's not. =
You can see the results here:
=
http://validator.w3.org/feed/check.cgi?url=3Dhttp%3A%2F%2Fin factvideo.com%=
2Fpodcast.php

It's throwing a 500 error, a parsing error, and complaining that feeds =
should not be served with the "text/html" type, even though I'm serving =
the right header. Other PHP pages on this site work fine, and there are =
no special Apache directives on my site that works that are missing =
here. Can anyone suggest what I might be missing?

- Brian=

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Brian Dunning [ Mi, 03 Februar 2010 20:34 ] [ ID #2031220 ]

Re: Can't get my PHP-generated RSS to serve properly

Brian Dunning wrote:
> Hey all -
>
> Glad some of you found that sample data helpful. :-)
>
> I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is submitted as *.xml and I use .htaccess to redirect it to my PHP document. The start of the document sets the right header and outputs the <? & ?> to prevent PHP from trying to process the leading XML line as code (this is cleaned up a bit for readability):
>
> <?php
> header("content-type: application/rss+xml");
> echo '<?';
> ?>
> xml version="1.0" encoding="UTF-8"
> <?php
> echo '?>';
> ?>
> <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
>
> This has always worked fine on one podcast, but on a new one it's not. You can see the results here:
> http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Finfa ctvideo.com%2Fpodcast.php
>
> It's throwing a 500 error, a parsing error, and complaining that feeds should not be served with the "text/html" type, even though I'm serving the right header. Other PHP pages on this site work fine, and there are no special Apache directives on my site that works that are missing here. Can anyone suggest what I might be missing?

A 500 error is indicating a failure at the server/script level. The
parse error I assume you see in your error logs. Correct the parse error
and you should be able to move forward. The text/html error is related
to the parse error since that prevents your script from running and
properly setting the content type header.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings [ Mi, 03 Februar 2010 20:41 ] [ ID #2031223 ]

Re: Can't get my PHP-generated RSS to serve properly

Ugh. Stupid me. Thanks Robert. It was a type elsewhere in my code =
further down the page. I was so hung up thinking it was an encoding or =
MIME or delivery problem I didn't think to check my PHP.

Someone slap me upside the head please.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Brian Dunning [ Mi, 03 Februar 2010 20:45 ] [ ID #2031225 ]

Re: Can't get my PHP-generated RSS to serve properly

Brian Dunning wrote:
> Hey all -
>
> Glad some of you found that sample data helpful. :-)
>
> I use PHP/MySQL to generate RSS feeds of my podcasts. The feed is
> submitted as *.xml and I use .htaccess to redirect it to my PHP
> document. The start of the document sets the right header and outputs
> the <? & ?> to prevent PHP from trying to process the leading XML
> line as code (this is cleaned up a bit for readability):
>
> <?php header("content-type: application/rss+xml"); echo '<?'; ?> xml
> version="1.0" encoding="UTF-8" <?php echo '?>'; ?> <rss
> xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
> xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
>
> This has always worked fine on one podcast, but on a new one it's
> not. You can see the results here:
> http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Finfa ctvideo.com%2Fpodcast.php
>
>
> It's throwing a 500 error, a parsing error, and complaining that
> feeds should not be served with the "text/html" type, even though I'm
> serving the right header. Other PHP pages on this site work fine, and
> there are no special Apache directives on my site that works that are
> missing here. Can anyone suggest what I might be missing?
>
> - Brian

Don't know if it is beneficial to you, but this is what I use (and
wrote) for RSS feeds -

http://www.phpclasses.org/browse/package/5942.html

Not tried it for podcasts.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Michael Peters [ Mi, 03 Februar 2010 21:20 ] [ ID #2031226 ]
PHP » gmane.comp.php.general » Can't get my PHP-generated RSS to serve properly

Vorheriges Thema: Thinking of moving to .NET because of standalone... any suggestions?
Nächstes Thema: DOM TextArea (and dom chart please)