Sorry!
Here's a commented version 🙂
// Make sure output buffering is on
ob_start();
// Call phpinfo
phpinfo();
// Get the contents of what's been buffered
$info = ob_get_contents();
// Clear the buffer so we can just write the
// xml info
ob_end_clean();
// here you parse the HTML from phpinfo()
// for what you want (contained in $info).
// Since it is usually the same that should
// be easy enough
echo parseForXmlInfo($info);