400 Bad Request while GET from arduino

Username :epiz_27679512 or wifiactive.rf.gd

i am working on arduino program that get data from the site and control lights/ pins in arduino uno through wifi esp-01 module. while in the browser the content displayed correctly webpage also appeared correct but while call from Arduino using " > GET TX.php?id=99999&pw=12345&un=1&n1=0 HTTP/1.0"

it replied as

16:37:56.170 → Recv 122 bytes
16:37:56.170 →
16:37:56.170 → SEND OK
16:37:56.170 →
16:37:56.170 → +IPD,295;HTTP/1.1 400 Bad Request
16:37:56.170 → Server: nginx
16:37:56.170 → Date: Mon, 18 J

please tell me how to slove this is i have to modify the arduino prog. or the TX.PHP file. i’m new to this PHP kindly elaborate in detail. also i’m attach my arduino prog.

only the declaration and server calling part is here:

String server = "wifiactive.rf.gd"; //Your Host 
String uri = "TX.php?id=99999&pw=12345&un=1&n1=0"; // Your URI

Serial.println("AT+CIPSTART=\"TCP\",\"" + server+ "\",80");
sendData("AT+CIPSTART=\"TCP\",\"" + server+ "\",80\r\n",1000,DEBUG);//start a TCP connection.
if( esp.find("OK")!=-1) {

Serial.println("TCP connection ready");

 delay(1000);
//Serial.println("TCP connection not");

String getRequest =
"GET " + uri + " HTTP/1.0\r\n\r\n" +
"Host: " + server + "\r\n" +
"Accept: *" + "/" + "*\r\n" +
"Content-Type: application/json\r\n" +
"\r\n";

String sendCmd = "AT+CIPSEND=";

sendData(sendCmd+getRequest.length()+"\r\n",100,DEBUG);
int j=getRequest.length();
//sendData(j+"\r\n",10,DEBUG );
 Serial.println(getRequest); 
delay(1000);

if( esp.find(">")) 
{ 
  Serial.println("Sending.."); 
  Serial.println(getRequest); 
  sendData(getRequest,1000,DEBUG);
  
if( esp.find("OK")) { 
  
Serial.println("Packet sent");

while (esp.available()) {

String response = esp.readString();
Serial.println(response);
delay(1000);

if(response.indexOf("_b11")!=-1)
{
  digitalWrite(RED_BULB, HIGH);
}
6 Likes

i am not sharing any file. i’m accessing that webpage using arduino accoding to its details arduino output changes

Do you even read the link i share?
Read, websites hosted in IF can only accessed in web browser, like Firefox and Chrome, not Arduino

3 Likes

sorry i just read it. thanks

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.