1
from http.server import HTTPServer, BaseHTTPRequestHandler

class xxx(BaseHTTPRequestHandler):
    def do_GET(self):
        self.path = "/index.php"
        try:
            file_to_open = open(self.path).read()
            self.send_response(200)
        except:
            file_to_open = "File cannout found!"
            self.send_response(404)
    self.end_headers()
    self.wfile.write(bytes(file_to_open, "utf-8"))

httpd = HTTPServer(("localhost", 8080), xxx)
httpd.serve_forever()

PHP is save in HTML comments.

How can I remove extra part of string in index.php?

I would like to remove all <!-- and -->.

J. Doe
  • 11
  • 1
  • Just use string replacement functions. – Barmar May 09 '18 at 22:47
  • You should prefer using something that parses HTML tags over string replacement. What would be better than either of those, is disabling the comments from being output in the PHP config: https://stackoverflow.com/questions/30158095/why-does-some-php-code-render-as-html-comments – Sean May 09 '18 at 22:58

0 Answers0