Forum Moderators: open

Message Too Old, No Replies

XML feed generated with ASP

Wrong content-type headers?

         

dotme

8:36 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



I have an asp page that generates pure XML.

When opened with Internet Explorer, the xml renders fine. When I create another page with ASP to open and display the XML, that works great too. But a couple of people using PHP report that their server won't open the ASP-generated XML. The XML is an RSS NEwsfeed, but it is dynamic - could change every 2 minutes, so putting it in a static XML file on my server is not an option.

Do I have an issue with headers? Could that be why PHP scripts don't see the output as XML?

Here is the code for the meat of my script - I have left out the loops for dynamic data, but each loop creates a new item and it all renders fine, except if you're pulling it with a PHP reader. Anyone here created an XML/RSS feed with ASP and found this issue?

<?xml version="1.0" encoding="ISO-8859-1"?>
<% Response.Buffer = true
Response.ContentType = "text/xml"
%>
<rss version="2.0">
<channel>
<title>My Title</title>
<link>My Link</link>
<description>My Descriptiondescription>
<language>en-us</language>
<copyright>Copyright info</copyright>
<lastBuildDate><%=Now()%></lastBuildDate>
<ttl>20</ttl>
<item>
<title><%=Dynamic Data%>
</title>
<link><%=Dynamic Data%>
</link>
<description><%=Dynamic Data%>
</description>
</item>
</channel>
</rss>

mattglet

1:15 am on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it possible for you to provide a rendered version of the XML, without any personal info in it? I think the error/issue might be easier to see in the format the PHP people are getting it.

Easy_Coder

5:48 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This xml is invalid, try changing this and then reattempt:

<description>My Descriptiondescription>

to this

<description>My Description</description>

mattglet

7:05 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



EC-

I would bet that's just a typo posting to WebmasterWorld (he stripped out some code). IE wouldn't render that as valid (which he said it does).

Easy_Coder

2:25 am on Mar 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



dotme, I've created a feed with asp. The only differnce we have is that I've added:

<generator></generator>
<managingEditor></managingEditor>

tags inside the <channel> tag

and I don't have these tags:
<lastBuildDate></lastBuildDate>
<ttl></ttl>

I doubt thats causing an issue though.

Do you know if the php reader has support for RSS2?

Easy_Coder

2:28 am on Mar 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



oh, hey... by chance (i'm not a php coder) would this be causing a problem?
<?

isn't that a php delimeter instruction?

dotme

5:18 pm on Mar 23, 2005 (gmt 0)

10+ Year Member



Thanks everyone for the replies. After checking everything mentioned above, the issue turns out to be:

1 - PHP Webmaster #1 hadn't permissions to use fopen.
2 - PHP Webmaster #2 is hosted overseas and the server can't see mine. That one's bizarre... I can traceroute to it, not blocking ports, but oh well.

What clued me in was when I got my third PHP Webmaster yesterday. He implemented my sample reader code on a site he hosts with GoDaddy and he reported that it worked flawlessly. I had presumed that because the first two PHP webmasters to sign up couldn't open my feed, it must have been incompatibility between my feed and PHP. Many thanks again for all input.