PDA

View Full Version : [SOLVED] Some questions about php



nebu
October 26th, 2009, 02:31 PM
I have two php files xml.php and usexml.php

now this is what i have to implement.....

the xml.php produces xml data and the usexml.php parses the xml data provided by xml.php and then produces a html output using the data.....

how do i implement such functionality

Arndt
October 26th, 2009, 02:38 PM
I have two php files xml.php and usexml.php

now this is what i have to implement.....

the xml.php produces xml data and the usexml.php parses the xml data provided by xml.php and then produces a html output using the data.....

how do i implement such functionality

What information have you been given about PHP, HTML and XML so far?

You say "you have" those files. So what is it they do now? Nothing?

januzi
October 26th, 2009, 02:39 PM
Take a look at the php.net (simplexml, xml). There will be a lot of comments and examples.

mikejonesey
October 26th, 2009, 03:00 PM
Hi there to quickly render xml you will need to use the php header function to render the page as xml,

can't remeber exact code but it's along the lines of;
header("Content-Type: xml/plain") or text/xml

this must apear at the verry top of the page.

also if you wanted to add a bit more fun you can have apache render xml as php so you can put you php contents in a .xml file. (many cms systems use this method for .html pages).

in .htaccess or httpd.conf add a mime type

nebu
October 27th, 2009, 07:53 AM
you guys misunderstood me...

i have already coded the file which produces the xml output

however... i want to read the response this file makes by sending it a request from another php file

i have tried using the include() function to get the response from the php file.... however i just get the code from the php file which produces the xml rather than getting the actual xml....

CyberJack
October 27th, 2009, 08:47 AM
If you want the parsed code (xml output) you need to get the url instead of the file directly.
Then the $xml variable contains the xml generated by xml.php



$xml = file_get_contents('http://<url>/xml.php');

nebu
October 27th, 2009, 02:43 PM
ty

tht helped