Xml from php

My problem is as follows: I have a php page generating xml for me depending on vars passed by GET. ie, data.php?category=2 would return xml for section 2. This is great for flash but I’m trying to call it from another php file. If i use fopen(data.php) I get uncompiled source code. If i use simplexml_load_file(“data.php”) I get errors. I think it doesn’t like the <?php at the beginning. Has anyone ever run into a similar problem? Thanks.