Jump to content

[SOLVED] displaying XML in PHP


Decipher

Recommended Posts

Hey evryone,

 

I am trying to create RSS Feed using PHP

but when i use

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"; i am getting nothing.

but if i use

echo "?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"

it is displaying the the string

 

any suggestio??

Link to comment
Share on other sites

First Line you gave it is printing but next line it is not resulting in a improper XML :-(

 

Any more Suggestion..

I read bout rss classes also but most of the claasess are letting store the file in XML

but no one displays the XML within same PHP

 

???

Link to comment
Share on other sites

@chigley

 

I checked the View Source in Browser

 

That is displaying the correct XML File only

Since the extension in the browser is not XML may be its stripping off the tags or....

 

@ ToonMariner

How  to disable the short tags..

 

@Rojay

 

if i try to send the header won't it will throw an errror header() already being passed..

 

 

Link to comment
Share on other sites

well thats why you need to set the header the first thing

header ("content-type: text/xml");

 

try to add this before echo-ing anything

 

another thing is renaming the file to xml

 

and create ".htaccess" file and put this in it

 

<Files ~ "^[^\.]+$"> 
SetHandler application/x-httpd-php 
</Files> 
AddHandler application/x-httpd-php .xml

but all the xml files in this directory will be treated as php files

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.