$template_hooks are to be used in templates and thus you may only put html in them. If you have php, then you need to put it in your custom page and then assign the output to a variable which you spit out in a template. In your php page, don't use echo, use something like this:
PHP Code:
$my_variable = "Example 2: " . $xml->PresenceInfo->Example2 . "<br />";
And then put $my_variable in the template.