A php proxy that load an XML with url variables

I’m trying to load an XML through flash. The XML file does not have a corresponding crossdomain file, so it is impossible to load the XML directly through flash.

So normally I would just use a proxy php file to load the xml.
Like so:

<?php $url = 'http://somesite.com/thefile.xml; header('Content-Type: text/xml'); readfile($url); ?>

That way flash would just think it’s an XML file and everything is file.

But this time I need to pass some variables:

<?php $lat = $_GET['lat']; $lng = $GET_['lng']; $url = 'http://cbk0.google.com/cbk?output=xml&ll=' . $lat . ',' . $lng; header('Content-Type: text/xml'); readfile($url); ?>

But this does not seem to be working.

How can I pass the variables and return the XML file?

Thank you.

Not 100% sure, but I believe what you’re looking for is simplexml_load_file();

If that isn’t what you are looking for, I’m sure you will be bound to find a solution here:
http://www.php.net/manual/en/book.simplexml.php

Sponsor our Newsletter | Privacy Policy | Terms of Service