getting file_get_contents to display contents of an XML file
Posted: Wed Jun 24, 2009 10:20 pm
Hey all,
Much appreciation in advance for any help received.
I'm writing a simple page that retrieves data in XML format and displays it as a table. I've been using HTML/JS successfully for testing on my own machine, but once I get it onto the production server I get 304 errors in Apache and an Access denied error in my HttpXML "GET" statement. I e-mailed my admin and asked for some pointers, and he said that the issue is cross-site scripting. My page is attempting to access content on a different website, and thus is failing. I need to move the GET request to a URL on your website. That GET request should hit a server-side script that returns the XML content from the database (via, for instance, a PHP file_get_contents() or a CURL command).
My question is: how do I do this? I'm learning PHP as-I-go here, but can't spend any more time learning -- I need to have something coded fast.
Some things: My request for the data is being passed through URL, so there are some ?= and &= parameters in there. I could pass the parameters through XML, but I don't quite understand how to do that (steep learning curve with zero time, unfortunately). I've tried using $_GET to reconstruct the URL in the PHP file for the file_get_contents(), but it doesn't seem to be working: my PHP code doesn't output anything.
So again, HTML file (with various inputs) calls PHP file, needing to pass parameters to generate the URL for the query. PHP file takes URL and returns XML. HTML file receives XML and displays it as a nice table.
Thanks for your help!
-tempomental-
Much appreciation in advance for any help received.
I'm writing a simple page that retrieves data in XML format and displays it as a table. I've been using HTML/JS successfully for testing on my own machine, but once I get it onto the production server I get 304 errors in Apache and an Access denied error in my HttpXML "GET" statement. I e-mailed my admin and asked for some pointers, and he said that the issue is cross-site scripting. My page is attempting to access content on a different website, and thus is failing. I need to move the GET request to a URL on your website. That GET request should hit a server-side script that returns the XML content from the database (via, for instance, a PHP file_get_contents() or a CURL command).
My question is: how do I do this? I'm learning PHP as-I-go here, but can't spend any more time learning -- I need to have something coded fast.
Some things: My request for the data is being passed through URL, so there are some ?= and &= parameters in there. I could pass the parameters through XML, but I don't quite understand how to do that (steep learning curve with zero time, unfortunately). I've tried using $_GET to reconstruct the URL in the PHP file for the file_get_contents(), but it doesn't seem to be working: my PHP code doesn't output anything.
So again, HTML file (with various inputs) calls PHP file, needing to pass parameters to generate the URL for the query. PHP file takes URL and returns XML. HTML file receives XML and displays it as a nice table.
Thanks for your help!
-tempomental-