My free webhost appends statistics javascript to any or all PHP and HTML files. That is fine, with the exception that I am using nuSoap to produce a WSDL apply for a webservice I am focusing on. My darn host adds this to my php-produced WSDL file.

Many people have recommended add this towards the .htaccess file:

AddType text/xml .php

That is dandy, however it hinders the PHP engine too, and there is not a way to create the WSDL then.

I have looked everywhere, no luck. Webhost doesn't react to emails or support tickets either.

Edit: The script my webhost uses is Histats. Released by Also, this JavaScript block falls outdoors the <html></html> tags and will not pass validator.

According to @Gerben's comment...

Adding <!-- doesn't work. The host already begins their extra stuff having a comment, and also the --> that follows will get overridden.

Adding header('Content-Type: text/xml'); does nothing, the javascript still shows.

HOWEVER! We have found the solution... putting exit(); in the finish from the PHP script will disable this function!

Like a side note to Mr. @Gerben -- Thanks, and I have chosen up your other solutions, which means you get credit with this...