tysontune Posted December 8, 2006 Share Posted December 8, 2006 I'm building an application that is essentially a back end supplying xml to both flash and PHP. The PHP front end is created through XSLT. The xml files are output dynamically by setting the text/xml header in PHP. Since the PHP page that does the xsl transform is on the same server as the xml producing back end, simple reading the xml files gives me the actual code contents of the file, not the compiled xml output. To get around this, I have created a CURL function set that grabs the xml through http, which get's the correct data. It also does this for the xsl files which are created with php files and output as text/xml as well.I'm married to the xml return for this one since that is how the data gets into the Flash component, and the database caching system I have setup returns the xml as well.So here's the question. Am I creating too many requests to the server for this solution to scale? In essence, you go to a page which calls two other pages via http, then does the transform. This seems counter intuitive, but it is in widespread use with httprequest and ajax all over the web.The alternate is to create the output each an xslt is called, but this seems like more strain on the server than simple requests.Any idea what will scale better? Quote Link to comment https://forums.phpfreaks.com/topic/29958-using-curl-and-xslt/ Share on other sites More sharing options...
adaniels Posted December 8, 2006 Share Posted December 8, 2006 If I understand you correctly you want:$file = 'generate_xml.php';ob_start();include($file);$xml = ob_get_contents();ob_end_clean();You might want to use set_error_handler to make sure the errors are displayed on the screen in not in $xml. You should also not send text/xml header in generate_xml.php by checking if basename($_SERVER['SCRIPT_FILENAME']) == __FILE__;Hope this helps,Arnold Quote Link to comment https://forums.phpfreaks.com/topic/29958-using-curl-and-xslt/#findComment-137665 Share on other sites More sharing options...
tysontune Posted December 10, 2006 Author Share Posted December 10, 2006 Perfect! I blanked entirely on output buffer. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/29958-using-curl-and-xslt/#findComment-138687 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.