Question

How would I go about using XmlReader in C# to read in a php that someone else has written that returns an XML document. Using .Create("PathToPHP.php") fails to work as I think it is just reading in the php document. I can post source code to the C# that I have if I am thinking about what Create actually does wrongly.

Was it helpful?

Solution

Your PHP document needs to be hosted on the server in order to output the HTML. If you are reading it like .Create("C:\MyXMLoutput.php"), it's not going to work because it is being accessed directly, therefore it is just like any other text file.

However, if you are accessing your PHP like .Create("http://urltophp.com/MyXMLoutput.php") it will work. It means you are asking the Webserver to parse the PHP code for you and return the output (which will be xml).

To validate the output, try opening the URL to the PHP in your browser and see it's output.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top