tags:

views:

30

answers:

2

I know it sounds weird but I need it for a workaround.

So some link in an ActionScript links for a .php file. As I am unable to edit this link in the AS I need some workaround. I have the xml and the .php file needs to output that exact xml code. How can this be done. Ultimately I would like to create a .php script that outputs xml. Where can I find instructions on how to do this? thanks!

+3  A: 

If I have understood you correctly, the following should do what you are asking:

<?php

$xmlContent = file_get_contents('/path/to/xml/file');

header('Content-type: text/xml; charset=utf-8');

if ($xmlContent) {
   // file available       
   echo $xmlContent;
   exit();
}

// indicate failure, e.g.
echo '<?xml version="1.0" encoding="utf-8?>
<result>
 <status success="0">
</result>';
Cez
I think I found my hero right now and right here. I got my flash application all up and running because of this! Many thanks and kudo's!!
Andy
A: 

Do you mean something like this:

header( 'Content-Type: text/xml', true );
readfile( '/path/to/your/xml/file.xml' );

(Cez' answer is definitely more error proof)

Or do you mean you need to adjust some xml from the file first? In that case you might want to look at one (or more) of the following:

fireeyedboy
Thanks for the links!! I think I'll dig deeper into SimpleXML. I expect I'll have to change the xml files a lot. Thanks!
Andy