Webhoster Inserts a JavaScript Which Brokes My Code How to Remove It

Webhoster inserts a javascript which brokes my code how to remove it?

They have a link in their cPanel where you can disable the analytics code.

http://members.000webhost.com/analytics.php

EDIT

Beware - by doing this you violate their policy and they will eventually drop you from their service and you will lose all your data.

PHP Header JSON showing weird thing

Looks like an auto append that your host set up. You can try and put exit; at the end of your PHP script preventing it from reaching the end where the auto append would happen.

See here for similar issue:
Webhoster inserts a javascript which brokes my code how to remove it?

Edit:
I should note depending on the level of access your host grants you other options (less hacky) may be available to you. Read above link.

want to Remove lines after the /body WordPress

If i'm not mistaken, this line of code is being added by your hosting company.
I guess that it's a free hosting company. I guess you can't remove it since it's being added after you're uploading the file or on the fly.

Anyway, Take a look at this solution:
https://stackoverflow.com/a/2268958/998096

Just mentioning,

by doing this you violate their policy and they will eventually drop
you from their service and you will lose all your data.

So do it on your own risk.

PHP Generated CSV File filled with html crap from webhost instead of data?

Disable the insertion of their analytics code from their control panel:

http://members.000webhost.com/analytics.php

From: http://www.000webhost.com/forum/faq/7894-faq-frequent-ask-questions-guide.html

Print script along while returning json

The Problem

Your hosting provider is injecting ads into the response body you are sending back. There are two ways you can fix this. The first is that you remove it from every response (just remove the first n number of lines when your Javascript parses it), or you can find a way to work around the way the system is implemented.

Removing It From Javascript

I'm assuming you are ingesting the response in Javascript (however the same idea would apply anywhere).

// break the textblock into an array of lines
var lines = jsonResponse.split('\n');
// remove one line, starting at the first position
// the removing the next 4 elements.
lines.splice(0,4);
// join the array back into a single string
var jsonResponse = lines.join('\n');

Turning off Analytics

I'm not sure, but I'm guessing you are using 000webhosts. If you are, any of the methods in here work for you:

Webhoster inserts a javascript which brokes my code how to remove it?

Changing appending rules in .htaccess

<FilesMatch "\.(php)$">
php_value auto_append_file none
</FilesMatch>

Receiving extra info from server response

It seems, that your hoster has configured the server to append some analytics stuff. If you cannot disable it somewhere in a control panel, you might need to switch to a more reputable hoster. You could also try to modify the header with header() to get rid of this:

Also, have a look at this question:

Webhoster inserts a javascript which brokes my code how to remove it?



Related Topics



Leave a reply



Submit