Error 400 Bad Request

"GET /insert.php?data="

You should use HTTP POST for inserting data, not GET.
The HTTP specification requires GET requests to be safe and idempotent. RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

The problem is that you didn't finish the request line with a newline + carriage return before sending the host header.

Pieter