Saturday 15 September 2012

Getting XML file content as string in php -


I want to display the contents of an XML file as my own. I do not want to parse it, instead read its content and display it.

I tried

  $ content = file_get_contents ("test.xml");   

But there is xml in $ content . When I have the var_dump ($ content) output string (899) "" is it possible to read without a corresponding file. Please help me

Thank you.

it should be resolved

  $ content = htmlentities (file_get_contents ( "Test.xml"));   

and should resolve it:

  header ("content-type: text / plain"); $ Content = file_get_contents ("test.xml"); Var_dump ($ content);   

This tells the browser sending plain text to you so that XML is not provided as HTML tags (which is then unknown and hidden).

No comments:

Post a Comment