HTTP 400 bad request

So I am using the arduino uno and ESP8266 module to log data to a mySQL database using XAMPP and myPHPadmin, I have managed to connect to the server and have previously been able to write null values to the database, however all of a sudden i am getting a HTTP 400 bad request when initialising my code, ontop of this after printing the server information, it dribbles off to useless strings.

+IPD,0,884:HTTP/1.1 400 Bad Request
Date: Sun, 16 Oct 2016 09:05:20 GMT
Server: Apache/2.2 i3)pnL10hP/..
Vy cp-nueactcre
ce-ag:be
Cnco:ls
ottTp e/tlcas=t8
oetagg:e
xrs n c 1 :52GT
<x ein10 cdg"T8?
!OYEtlPLC-/C/TXT .Src/N
hp/w.3r/Rhm/Txtlsrtdd
<m ms"t:/wwog19xm"ag""x:age"
ha
<teB eet/il
<n e"a"he"at:omselchs"><tltp=ets"<-*>!CT[>!-
by{oo:000 agoncl:#FF;
:n lr#00;} pads mgnet m}
pn{n-z:sle}
*>/-/te
<ed

oy
h>drqs!+P,40/1
p

Yrboe rpo)snarus a
i ee udo nrtd

/><>
otikhssasvrro la oat
e<he=al:otse@cls"emtr/.

p
h>rr0<h
<des
r=/lcls<ab
ah/42(i2 pSL..hH/53<pn
/des
/o>
hm

0LS

Press any key to test server.

Server started!

any help as soon as possible would be greatly appreciated!!

final.ino (9.93 KB)

Don't know if this is your entire problem, but you must send a blank line at the end of the request header. Note the double "\r\n" after "Connection: close". Or you can use "client.println()" instead.

const String httpRequest = "GET/test.php\r\n"
                           "Host: 192.168.43.151\r\n"
                           "Connection: close\r\n\r\n";
const String httpRequest = "GET/test.php\r\n"

There needs to be a space after GET and either " HTTP/1.0" or " HTTP/1.1" before the \r\n.

So i have done this and now i am no longer getting an error message, it will not connect to the server at all...

PaulS:

const String httpRequest = "GET/test.php\r\n"

There needs to be a space after GET and either " HTTP/1.0" or " HTTP/1.1" before the \r\n.

nevermind! realised i had missed a space in the second GET request, thank you for your help!!